Jump to content

Warning: mysql_num_rows() expects parameter 1 to be resource


bleured27

Recommended Posts

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in G:\xampp\htdocs\checklogin.php on line 27

verkeerde naam of wachtwoord

 

hy help needed i serched on the internet for a solution "i cant find a good 1 zo plz help me"

 

<?php

 

ob_start();

$host="localhost";                      // Host name

$username="root";                      // Mysql username

$password="";                            // Mysql password

$db_name="brsgamev1.0";        // Database name

$tbl_name="thegamev1.0";        // Table name

 

// Connect to server and select databse.

mysql_connect("$host", "$user", "$pass")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");

 

 

$user=$_POST['user'];

$pass=$_POST['pass'];

 

 

$user = stripslashes($user);

$pass = stripslashes($pass);

$user = mysql_real_escape_string($user);

$pass = mysql_real_escape_string($pass);

 

$sql="SELECT * FROM $tbl_name WHERE user='$user' and pass='$pass'";

$result=mysql_query($sql);

 

$count=mysql_num_rows($result);

 

 

if($count==1){

 

 

session_register("user");

session_register("pass");

header("location:login_success.php");

}

else {

echo "Wrong Username or Password";

}

 

ob_end_flush();

?>

 

 

Link to comment
Share on other sites

For pete's sake if you want help at least show us you care enough about what you're doing to sit down and write a proper sentence explaining what is wrong and what you want, and demonstrate that you've tried the suggestions already.

 

Spelling matters.

Link to comment
Share on other sites

$result being false means your query failed or returned no rows.

 

$result will still be a valid resource if the query returns 0 rows.

 

hy tnx for the quik mssg i dont need the relevant stuf still tnx <not whole script> still i need to know how to replase the $quer or it cant becose there are 3 fields in table and only 1 accaunt?

 

Huh?

 

What does the following yield? $result=mysql_query($sql) or die('Query: ' . $sql . '<br />Error: ' . mysql_error());

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.