From: Trevor Rhodes [mailto:[EMAIL PROTECTED] > Hello friendly helper types, > > What is the problem here. I can't find any errors. I know > it's there but as a > newbie I'm as blind as a bat at the moment. Thanks for your help. > > Warning: mysql_num_rows(): supplied argument is not a valid > MySQL result > resource > Warning: mysql_fetch_row(): supplied argument is not a valid > MySQL result > resource > > =========================== > $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 domains" ); > $num_rows = mysql_num_rows( $result ); > print "There are currently $num_rows rows in the table"; > 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 ); > ===========================
Have you tried including $link as a second argument in mysql_query()? mysql_query( "select * from domains", $link ); IIRC, it's not necessary, but it might be worth a shot. -- Mike Johnson Web Developer/Systems Asst. Smarter Living, Inc. phone (617) 497-2500 x226 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]