PHP Code:
<?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:
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:
for (i=0; i<15; i++) {
to this:
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 - swf file
http://www.darrenandnicole.com/testing/xmltest.php - php file
Would appreciate any help. Thanks.