hi
when i run the following query:
$result = mysql_db_query( $thisdb, 'SHOW fields FROM $tablename");
$num = mysql_num_rows( $result);
i get the following error:
Warning: mysql_num_rows(): supplied arguement is not a valid MySQL result resource
I have echoed out the query and it knows what the variables are and it runs fine in MySQL front.
Can anyone help?
mysql_num_rows() error.....
Moderator: General Moderators
-
struggling_student
- Forum Newbie
- Posts: 15
- Joined: Mon Feb 23, 2004 3:51 pm
http://php.net/mysql_db_query
"Note: This function has been deprecated since PHP 4.0.6. Do not use this function."
Try this instead.
$sql = 'SHOW fields FROM $tablename";
$result = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows( $result);
Also add ' or die(mysql_error())' onto your mysql_connect() and mysql_select_db() lines.
"Note: This function has been deprecated since PHP 4.0.6. Do not use this function."
Try this instead.
$sql = 'SHOW fields FROM $tablename";
$result = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows( $result);
Also add ' or die(mysql_error())' onto your mysql_connect() and mysql_select_db() lines.