here is my source code about login into a web

<?php 
/*
$login=$_POST['login'];
if($login=="Login")
{ */
    $connect==mysql_connect("localhost","root","");

    if(!connect)
    {
       die ('Cannot connect to the database'.mysql_error()); }
  
mysql_select_db("firstdbs",$connect);

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

// To protect MySQL injection
 $in_user = stripslashes($in_user);
 $in_pass = stripslashes($in_pass);
 $in_user = mysql_real_escape_string($in_user);
 $in_pass = mysql_real_escape_string($in_pass);
 
$sql="SELECT * FROM login WHERE de_user='$in_user' and de_pass='$in_pass' ";

$result= mysql_query($sql);
$count=mysql_num_rows($result);  print($count);
if($count==1)
{
echo "dsfaf";
}
else
echo "Wrong something! Please re-login";


?>

but when I open it through the browser it raised some warnings like:

Warning: mysql_select_db() expects parameter 2 to be resource, null given in C:\xampp\htdocs\EX1\page1.php on line 12

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\EX1\page1.php on line 26
Wrong something! Please re-login
I do not know the reason.
Please help me!

You only need one = on your mysql_connect statement.

You only need one = on your mysql_connect statement.

oh, thank you! I also found this mistake several minutes ago!

oh! thank you very much!I also found this mistake several minutes ago!
^ ^

Give single "=" sign instead of double "==" in follwing line:
$connect==mysql_connect("localhost","root","");
This surly works
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.