I wanna list all the rows from a specific mysql table in another table . But i get this error. I search all google for a something but i can't find nothing . Please help me !
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
C:\xampp\htdocs\toate.php on line 38
There are currently rows in the table
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\toate.php on line 42
This is my php code :
$user = "boss";
$pass = "123";
$db = "test";
$link = mysql_connect("localhost", $user, $pass );
if ( ! $link ){
die( "Couldn't connect to MySQL" );
}
mysql_select_db( $db, $link ) or die ( "Couldn't open $db: ".mysql_error() );
$result = mysql_query( "SELECT * FROM Employee" );
$num_rows = mysql_num_rows( $result );
print "There are currently $num_rows rows in the table<P>";
print "<table border=1>\n";
while ( $a_row = mysql_fetch_row( $result ) ){
print "<tr>\n";
foreach ( $a_row as $field )
print "\t<td>$field</td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close( $link );