- Forums
- MySQL
- Help - Warning: Mysql_num_rows(): Supplied Argument Is Not A Valid MySQL
This Page Contains information about Help - Warning: Mysql_num_rows(): Supplied Argument Is Not A Valid MySQL By wallpaperama in category MySQL with 2 Replies. [867], Last Updated: Sat May 18, 2024
wallpaperama
Thu Jan 11, 2007
2 Comments
2906 Visits
i just created a php script with mysql and for some reason i am getting this error:
CODE:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in mysite/www/index.php on line 48
can you guys help me how to get this fix, i dont understand the supplied part nor the mysql_num_rows() functions, not even why i get this warning.
i have also created the following php code an recieved the error
warning: mysql_num_rows(): supplied argument is not a valid mysql result resource in c:\wamp\www\zetechnew\stafflogi on line 26
the code is as follows:
start or phpcode
$host="localhost"; // host name
$username="wycliff"; // mysql username
$password="dawa"; // mysql password
$db_name="zetech"; // database name
$tbl_name="staff"; // table name
// connect to server and select databse.
mysql_connect("$host" "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select db");
// username and password sent from form
$myusername=$_post['staff name'];
$mypassword=$_post['password'
// to protect mysql injection (more detail about mysql injection)
$myusername = stripslashes($myusername);
$mypa = stripslashes($mypassword);
$myus = mysql_real_escape_string($myusernam = mysql_real_escape_string($mypasswor * from $tbl_name where staffname='$myusername' and password='$mypassword'";
$res mysql_num_row is counting table row
$count=mysql_num_rows($resul if result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// register $myusername, $mypassword and redirect to file "login_success.php"
session_re
header("location:aboutus.php" {
echo "wrong username or password";
}
?>
kindl help