从 SQL 数据库中检索列表并为 AS3 中的每一行创建链接

retrieve list from a SQL database and create links for each lines in AS3

我正在尝试在这些条件下开发一个 AIR 应用程序:

我有一个 SQL 数据库。在我的 table 中有一个 "categories" 列(具有不同的类别(计算机、书籍等))。

在我的 AS3 中,当用户选择一个类别时,我设法检索到 "theDescription"。 使用 URLMethod 和 php 文件。

    // 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;

所以我的 AS3 代码从 php 中检索 $phptheDescription 并将其显示在 output_txt 中。

问题:在我的 output_txt 中,只显示了一个 "theDescription"。但是我在类别 "Informatique" 中有两个项目(我可以在同一类别中有 100 个项目)。

如何显示同一类别中的所有 "theDescription"?

例如:如果我选择"Informatique",它应该显示"Une Surface Pro 3"和"Un IMAC"。 但它只显示最后一项 "Un IMAC"。

然后,是否可以为显示的每个项目创建 "links"?


编辑

解释我的问题的视频:

https://vid.me/DS2r

http://sendvid.com/6iesrygk

您已经找到行,但没有回应描述,您可以将代码编辑为:

while ($row = mysql_fetch_array($sql_result)) {
 $theDescription = $row["theDescription"];
 //$phptheDescription = $theDescription;
 echo $theDescription;
}

或像这样连接所有字符串

$phptheDescription='';
while ($row = mysql_fetch_array($sql_result)) {
     $theDescription = $row["theDescription"];
     $phptheDescription = $phptheDescription.' , '.$theDescription;
    }
 echo $phptheDescription;