SAE中怎么输出MySQL数据?我的PHP代码只能循环输出第一行数据!
echo"<tableborder='1'bgcolor='lightblue'align='center'>";echo"<tr><th>用户名</th><th>密码<...
echo "<table border='1' bgcolor='lightblue' align='center'>";
echo "<tr><th>用户名</th><th>密码</th><th>姓名</th><th>Email</th></tr>";
while($row = $db->getLine($sql)){
echo "<tr><td>{$row['f_username']}</td>";
echo "<td>{$row['f_password']}</td>";
echo "<td>{$row['f_name']}</td>";
echo "<td>{$row['f_email']}</td></tr>\n";
}// while
echo "</table>"; 展开
echo "<tr><th>用户名</th><th>密码</th><th>姓名</th><th>Email</th></tr>";
while($row = $db->getLine($sql)){
echo "<tr><td>{$row['f_username']}</td>";
echo "<td>{$row['f_password']}</td>";
echo "<td>{$row['f_name']}</td>";
echo "<td>{$row['f_email']}</td></tr>\n";
}// while
echo "</table>"; 展开
1个回答
展开全部
echo "<table border='1' bgcolor='lightblue' align='center'>";
echo "<tr><th>用户名</th><th>密码</th><th>姓名</th><th>Email</th></tr>";
$query2=$db->query($sql);
while($row=$db->fetch_array($query2)){
echo "<tr><td>{$row['f_username']}</td>";
echo "<td>{$row['f_password']}</td>";
echo "<td>{$row['f_name']}</td>";
echo "<td>{$row['f_email']}</td></tr>\n";
}// while
echo "</table>";
echo "<tr><th>用户名</th><th>密码</th><th>姓名</th><th>Email</th></tr>";
$query2=$db->query($sql);
while($row=$db->fetch_array($query2)){
echo "<tr><td>{$row['f_username']}</td>";
echo "<td>{$row['f_password']}</td>";
echo "<td>{$row['f_name']}</td>";
echo "<td>{$row['f_email']}</td></tr>\n";
}// while
echo "</table>";
追答
echo "";
echo "用户名密码姓名Email";
$row = $db->getData($sql);
$rowcount=$db->affectedRows();
$i=0;
while($i{$row[$i]['f_username']}";
echo "{$row[$i]['f_password']}";
echo "{$row[$i]['f_name']}";
echo "{$row[$i]['f_email']}\n";
$i=$i+1;
}// while
echo "";
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询