try adding an error report after the query

$result = mysql_query( "select * from domains" ) or die (mysql_error());

the rest looks OK


Peter

-----Original Message-----
From: Trevor Rhodes [mailto:[EMAIL PROTECTED]
Sent: 17 December 2003 22:26
To: [EMAIL PROTECTED]
Subject: Basic error


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

 Regards
      Trevor Rhodes
===========================================
Powered by Linux                -             Mandrake 9.1
Registered Linux user # 290542 at http://counter.li.org
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.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to