Php 从SQL数据库检索列表,并为AS3中的每一行创建链接
我正在尝试使用以下条件制作AIR应用程序: 我有一个SQL数据库。在我的表格中有一个“类别”列(有不同的类别(计算机、书籍等)) 在我的AS3中,当用户选择分类时,我设法检索“描述”。 使用URL方法和一个php文件Php 从SQL数据库检索列表,并为AS3中的每一行创建链接,php,mysql,actionscript-3,flash,air,Php,Mysql,Actionscript 3,Flash,Air,我正在尝试使用以下条件制作AIR应用程序: 我有一个SQL数据库。在我的表格中有一个“类别”列(有不同的类别(计算机、书籍等)) 在我的AS3中,当用户选择分类时,我设法检索“描述”。 使用URL方法和一个php文件 // create SQL $sql = "SELECT * FROM annonces where categorie = '$categorie'"; $sql_result = mysql_query($sql, $connection) or
// 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,并将其显示在输出\u txt
中
问题:在我的输出\u txt
中,仅显示一个“theDescription”。但是我有两个项目在“Informatique”类别中(我可以有100个项目在相同的类别中)
如何显示相同类别中的所有“描述”
例如:如果我选择“Informatique”,它应该显示“Une Surface Pro 3”和“Un IMAC”。
但它只显示最后一项“Un IMAC”
然后,是否可以为显示的每个项目创建“链接”
编辑 解释我的问题的视频:
您已经输入了行,但没有回显描述,您可以将代码编辑为:
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;
要制作超链接,只需将$theDescription包装在锚定标记中的echo之后。链接的问题是:(开始的方式相同,但与上一篇文章的视频不同)