Page 1 of 1

mysql_num_rows issue

Posted: Thu Jul 21, 2005 12:47 pm
by itsmani1

Code: Select all

$query = "SELECT * FROM admin WHERE Login = '" . $_POST["fld_username"] . "' AND Pass = '" . $_POST["fld_password"] . "'"; 
 	$re = mysql_db_query($db,$query,$cid);
	$nu = mysql_num_rows($re);
when i run it on php 4.3 it gives me fowlling error:
any help plz.....
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/maairne/public_html/admin/act_login.php on line 16
-----------
Mannan

Posted: Thu Jul 21, 2005 2:19 pm
by John Cartwright
try

Code: Select all

$re = mysql_db_query($db,$query,$cid) or die(mysql_error());
and see what the cause is

Posted: Thu Jul 21, 2005 7:17 pm
by timvw
You might want to use http://www.php.net/mysql_real_escape to make sure MySQL is ready to handle the data...

For example, if someones posts O'Reilly, your query would break...

Posted: Fri Jul 22, 2005 12:19 pm
by itsmani1

Code: Select all

$dbh=mysql_connect ("localhost", "maairne_maair", "maairne_maair") or die (mysql_error());
mysql_select_db ("maairne_maair");
is this correct? using corrent password...