List:General Discussion« Previous MessageNext Message »
From:Trevor Rhodes Date:December 17 2003 10:25pm
Subject:Basic error
View as plain text  
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 
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result 

$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 );

      Trevor Rhodes
Powered by Linux                -             Mandrake 9.1
Registered Linux user # 290542 at
Registered Machine #'s 186951
Mandrake Club Silver Member
Source :  my 100 % Microsoft-free personal computer.
 09:25:17 up 1 day,  9:14,  1 user,  load average: 1.02, 1.09, 1.08
Never mud wrestle with a pig.. you get dirty and the pig enjoys it!
Never try to teach a pig to dance. You waste your time and annoy the pig.

Basic errorTrevor Rhodes17 Dec
  • RE: Basic errorPeter Lovatt17 Dec
  • Re: Basic errorSteve Davies18 Dec
  • Re: Basic errorTrevor Rhodes18 Dec
RE: Basic errorMike Johnson18 Dec