我试着在这些条件下做一个空中应用程序:
我有一个SQL数据库。在我的表中有一个“类别”列(有不同的类别(计算机,books..etc))。

在我的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“。但我有两个类别“信息”(我可以有100个相同的类别)。
如何显示属于同一类别的所有"theDescription“?
例:如果我选择“信息”,它应该显示"Une Surface Pro 3“和"Un”。但它只显示最后一项"Un“。
在此之后,是否可以为所显示的每一项创建“链接”?
编辑
解释我的问题的视频:
发布于 2016-01-11 23:24:55
您已经有了行,但是您没有回显描述,您可以编辑代码如下:
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;https://stackoverflow.com/questions/34732909
复制相似问题