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 \ttd$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]
RE: Basic error
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 \ttd$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]
Re: Basic error
Hi Trevor You haven't the query which connection to use: $result = mysql_query( select * from domains, $link ); HTH Steve Davies Trevor Rhodes wrote: 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 \ttd$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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Basic error
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 \ttd$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]
Re: Basic error
Hello friendly helper types, Forget it people. I'm an idiot. Just forgot to change the table name. Of course then it at least had more clue as to what it was doing that myself. I'm going away now, but you can be sure I'll be back with more silly questions later. Bye. :^) 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 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:48:09 up 1 day, 9:37, 1 user, load average: 1.97, 1.38, 1.15 -- 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]