// I love arrays.
$fruits = array();
while ($topic = mysql_fetch_assoc ($result)); {
$fruits[] = (string)$topic["overtag "];
}
// If you don't want an array, but a string instead, use implode:
$fruits = implode(' ', $fruits)
$fruits = "";
while ($topic = mysql_fetch_assoc ($result)); {
echo "{$topic["overtag "]} ";
$fruits .= $topic['overtag'] . " ";
}
// This is going to result in an extra space at the end, so:
$fruits = trim($fruits);
哦,还有,你有一个错误的分号,它会破坏你的while循环:
while ($topic = mysql_fetch_assoc ($result)); {
--------^^^--
4条答案
按热度按时间kkbh8khc1#
连接运算符
.=
zvms9eto2#
3df52oht3#
您只需要将每个变量连接到循环内的变量上
哦,还有,你有一个错误的分号,它会破坏你的while循环:
应道:
rxztt3cl4#
使用下面的PHP代码,您可以从数据库表中获取数据并显示在网页上: