2011-04-09
網站建置與架構 4/8
$link = mysql_connect("localhost","user","123") or die ("MYSQL連線失敗:".mysql_error());
MYSQL_SELECT_DB("my_database",$link) or die("選擇資料庫失敗:".mysql_error());
$result = mysql_query("select Employeeid, Name FROM Employees", $link);
if (mysql_num_rows($result) == 0)
{
echo "table至少要有一筆資料!
";
exit(1);
}
$num_rows = mysql_num_rows($result);
echo"$num_rows"."
";
#i = 0;
while ($i < $num_rows)
{
mysql_data_seek($result, $i);
$i++;
$fields = mysql_fetch_row($result);
echo "第 $i 筆資料:";
foreach($fields as $ual)
echo $ual.",";
echo "
";
}
?>
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言