Im finding it difficult to resolve the problem in my code and need a help out.
this is for my login page and its giving

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/****/public_html/login.php on line 13
That user doesn't exist

whiles i tested and can register successfully

<?php

session_start();

require "dbc.php";

$username = $_POST['username'];
$password = $_POST['password'];

if($username&&$password)
{
	$query = mysql_query("SELECT * FROM users WHERE username='$username'");
	$numrow = mysql_num_rows($query);

if($numrow!=0)
{
	while($row = mysql_fetch_assoc($query))
	{
		$db_username = $row['username'];
		$db_password = $row['password'];
	}

	if($username==$db_username&&$password==$db_password)
	{
		echo "Logged in <a href='members.php'>Click here to enter the members area</a>";
		$_SESSION['username']=$db_username;
	}
	else echo "Incorrect Password";
}
else echo("That user doesn't exist");
}
else echo("Please enter a username and password");

?>

    It appears that your query failed, quite possibly because you don't have a DB connection. Is there any debug/die statements in that dbc.php file that would indicate if the connection failed?

      Please use the boards [NOPARSE]

      ...

      [/NOPARSE] tags when posting PHP code as it makes it much easier to read and analyze.

      As for your problem, see the link in my signature for the steps to take for this error. It has been discussed ad nauseam.

        this is how my dbc.php looks like

        <?php

        mysql_connect("db_host","db_name","db_password") or die ("Couldnt connect to database");
        mysql_select_db("database") or die ("Couldnt find database");

        ?>

          instead of this
          mysql_connect("db_host","db_name","db_password") or die ("Couldnt connect to database");
          mysql_select_db("database") or die ("Couldnt find database");

          just pass the connection variable in mysql_select_db()
          something like this

          $conn = mysql_connect("db_host","db_name","db_password") or die ("Couldnt connect to database");
          mysql_select_db("database",$conn) or die ("Couldnt find database");

            Write a Reply...