# PHP Help

**URL:** <https://forum.kirupa.com/t/php-help/149698>\
**Category:** Uncategorized\
**Created:** [May 31, 2005, 5:55pm UTC](https://forum.kirupa.com/t/php-help/149698 "2005-05-31T17:55:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gumby19](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gumby19](https://forum.kirupa.com/u/Gumby19)\
**Post date:** [May 31, 2005, 5:55pm UTC](https://forum.kirupa.com/t/php-help/149698/1 "2005-05-31T17:55:24Z")

</div>

PHP Code:

```php
<?php
	mysql_pconnect ("localhost", "username", "password");
	 
	mysql_select_db('darrenan_weddingparty');
	$query = "select * from party order by title"; 
	
	$result = mysql_query($query);
	$numRows = mysql_num_rows($result);
	
	for ($i=0; $i<$numRows; $i++){

	 $row = mysql_fetch_array($result);
	 $rString = $row['name'];
	 //echo $rString.'<br>';
	 $pString.="&name".$i."=".$row['name'];

	}
	 echo $pString."&rowCount=".$numRows;
	?>

```

ActionScript:

```auto
var m = new LoadVars();
m.onLoad = function() {
	displayNames(this);
};
m.load("xmltest.php");
function displayNames(b) {
	c = b["rowCount"];
	a = "";
	for (i=0; i<15; i++) {
		_root.names.text = a+b["name"+i];
		a = _root.names.htmlText+newline;
	}
}

```

Ok, pretty much everything is working on this. My only problem, is that I want to change this line:

```auto
for (i=0; i<15; i++) {

```

to this:

```auto
for (i=0; i<c; i++) {

```

For some reason, it wont work. If I set the text box equal to c, it will return the correct number (15) when I upload it. But it won’t let me use it in the for loop. Is it reading ‘c’ as a string? I tried eval© and Number©, and no luck. I’m not sure why it would read it as a string anyway, because it is a number in the php code. You can check out what the files are returning here:

[http://www.darrenandnicole.com/testing/xmltest2.html](http://www.darrenandnicole.com/testing/xmltest2.html) - swf file  
[http://www.darrenandnicole.com/testing/xmltest.php](http://www.darrenandnicole.com/testing/xmltest.php) - php file

Would appreciate any help. Thanks.
