php - List all rows from mysql table in a list -



php - List all rows from mysql table in a list -

this question has reply here:

mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 32 answers why shouldn't utilize mysql_* functions in php? 10 answers

i wanna list rows specific mysql table in table . error. search google can't find nil . please help me !

warning: mysql_num_rows() expects parameter 1 resource, boolean given in c:\xampp\htdocs\toate.php on line 38 there rows in table warning: mysql_fetch_row() expects parameter 1 resource, boolean given in c:\xampp\htdocs\toate.php on line 42

this php code :

$user = "boss"; $pass = "123"; $db = "test"; $link = mysql_connect("localhost", $user, $pass ); if ( ! $link ){ die( "couldn't connect mysql" ); } mysql_select_db( $db, $link ) or die ( "couldn't open $db: ".mysql_error() ); $result = mysql_query( "select * employee" ); $num_rows = mysql_num_rows( $result ); print "there $num_rows rows in table<p>"; print "<table border=1>\n"; while ( $a_row = mysql_fetch_row( $result ) ){ print "<tr>\n"; foreach ( $a_row $field ) print "\t<td>$field</td>\n"; print "</tr>\n"; } print "</table>\n"; mysql_close( $link );

looks query failing due permissions error. mysql_query() returns false if occurs. take @ database permissions user. also, suggest using mysqli mysql extension deprecated.

edit: mysql_result returns false on errors, create sure double check query syntax.

php mysql performance

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -