我正在尝试将字符串添加到变量中,出于某种原因,唯一要考虑的部分是“
服务:”部分。
知道为什么会这样吗?
$lists = "<br />Services: ";
$servicearray = mysql_query("select serv_id from org_serv_xref where org_id='".$orgid."'");
while ($servicearrayrow = mysql_fetch_array($servicearray)) {
$servdescarray = mysql_query("select serv_desc from service where serv_id='".$servicearrayrow['serv_id']."'");
$lists . "<ul>";
while ($servdescarrayrow = mysql_fetch_array($servdescarray)) {
$lists . "<li>" . $servdescarrayrow['serv_desc'] . "</li>";
}
$lists . "</ul>";
}
答案 0 :(得分:6)
那是因为当你想要连接字符串时,你必须仍然使用=
符号,这使得连续符号像.=
您的代码必须如下所示:
while ($servicearrayrow = mysql_fetch_array($servicearray))
{
$servdescarray = mysql_query("select serv_desc from service where serv_id='".$servicearrayrow['serv_id']."'");
$lists .= "<ul>";
while ($servdescarrayrow = mysql_fetch_array($servdescarray))
{
$lists .= "<li>" . $servdescarrayrow['serv_desc'] . "</li>";
}
$lists .= "</ul>";
}