下面是我的代码:
<?php
include 'db_table.php';
include 'main.php';
if(isset($_GET['userid']) || (isset($_SESSION['userid'])))
{
if ((!empty($_GET['userid'])) || (!empty($_SESSION['userid'])) ) {
if(!isset($_GET['userid']) || empty($_GET['userid']) )
$userid=$_SESSION['userid'];
else
$userid=$_GET['userid'];
$query = "SELECT * FROM status WHERE userid = '$userid'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
if(!$row){ echo "<li class='form-line' id='id_3'><div id='cid_3' class='form-input-wide'><div id='text_3' class='form-html'>No Status so Far </div></li><br>"; }
else{
echo "<table>";
while($row = mysql_fetch_array($result)){
$finalstatus = $row['username']." says : ".$row['status'];
echo "<tr>";
echo "<td class='form-line' id='id_3'><div id='cid_3' class='form-input-wide'><div id='text_3' class='form-html'>".$finalstatus."</div></td>" ;
echo "</tr>";
}// while
echo "</table>";
}// else
}// empty
} // isset
else{echo "<li class='form-line' id='id_3'><div id='cid_3' class='form-input-wide'><div id='text_3' class='form-html'>No Status so Far </div></li><br>";}
?>
当我使用上面的代码时,我只得到数据库中存在的最后一个状态。但我需要在我的表上填充 mysql 表的完整状态