Copy link to clipboard
Copied
I'm trying to do an AIR app with these conditions :
I've got a SQL database. In my table there is a "categories" column (with differents categories (computer, books..etc)).
In my AS3 I manage to retrieve "theDescription" when the user choose a categorie. With the URLMethod and a php file.
// create SQL $sql = "SELECT * FROM annonces where categorie = '$categorie'";
$sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query.");
$num = mysql_numrows($sql_result); $phptheDescription = "";
$counter = 0;
while ($row = mysql_fetch_array($sql_result)) {
$theDescription = $row["theDescription"];
$phptheDescription = $theDescription;
}
echo "phptheDescription=" . $theDescription;
So my AS3 code is retrieving the $phptheDescription from the php and displays it in a output_txt
.
Problem : in my output_txt
, only ONE "theDescription" is displayed. But I have TWO items in the categorie "Informatique" (and I can have 100 items in the same categories).
How do I do to display all "theDescription" that are in the same categories ?
Ex: If I choose "Informatique", it should display "Une Surface Pro 3" and "Un IMAC". But it only displays the last item "Un IMAC".
And, after that, is it possible to create "links" for each item displayed ?
Here's 2 shorts videos (20 sec) explaining my problems :
Thx
Hi there - I've never used PHP so I may be wrong here - but It looks to me as though you're looping through the records, each time resetting $theDescription to be whatever is in the current record (rather than building up the output). So you're effctively only echoing the last record in the query.
I think you should be either executing the echo command inside your while loop, or alternatively concatenating to a string inside the loop and then echoing this at the end of the loop ?
I'd probably gene
...Copy link to clipboard
Copied
Hi there - I've never used PHP so I may be wrong here - but It looks to me as though you're looping through the records, each time resetting $theDescription to be whatever is in the current record (rather than building up the output). So you're effctively only echoing the last record in the query.
I think you should be either executing the echo command inside your while loop, or alternatively concatenating to a string inside the loop and then echoing this at the end of the loop ?
I'd probably generate XML in the PHP (just by concatenating strings) and then use this in my AS3 code.