mysql查询结果可以包含1或2行结果。我该如何分开它们?
$bio = mysql_query("SELECT *, FROM soc_meminfo
WHERE m_id = '".mysql_real_escape_string($en['id'])."'");
#
if (mysql_num_rows($bio) == 0) call404();
$line = mysql_fetch_assoc($bio);
foreach ($line as $key => $value) {
$en['b'.$key] = str_replace("\n",'<br/>',stripslashes($value));
}
答案 0 :(得分:2)
试试这个:
while ($row = mysql_fetch_assoc($bio)) { ... }
你的sql也应该是SELECT * FROM soc_meminfo
答案 1 :(得分:2)
试试这个
while ($row = mysql_fetch_assoc($bio)){
foreach ($row as $value){
echo $value;
}
echo '<br>';
}
答案 2 :(得分:0)
我不确定我理解它,但试试这个。
$bio = mysql_query("SELECT *, FROM soc_meminfo
WHERE m_id = '".mysql_real_escape_string($en['id'])."'");
#
if (mysql_num_rows($bio) == 0) call404();
$line = mysql_fetch_assoc($bio);
foreach ($line as $key => $value) {
$en['b'.$key][] = str_replace("\n",'<br/>',stripslashes($value));
}