-------------------------------------------------
<html>
<head> <title>test</title> </head>
<body>
<?php
define ('HOST', 'localhost');
define('DATABASE', "students schedule");
//$link = mysql_connect('localhost', 'root', '0000' ); //連到MySQL主機
//mysql_select_db("students schedule",$link); //連到資料庫
if( !mysql_connect(HOST) )
{
echo "connection fails";
}
else
{
mysql_select_db( DATABASE );
$dbSelect = mysql_query('Select * From students');
while( $arrPrintRows = mysql_fetch_array($dbSelect) )
{
echo "hihi";
}
}
?>
</body>
</html>
---------------------------------------------------
Error message
=>Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in C:\AppServ\www\new.php on line 23
指的是while( $arrPrintRows = mysql_fetch_array($dbSelect) ) 這行
應該是上一行$dbSelect = mysql_query('Select * From students');沒鏈結到database
麻煩各位教導如何處理,謝!
