mysql - PHP login conditon error -


i'm trying make simple login page in php, code echo "sorry, credentials not valid, please try again."...!! please help! :d

    <?php  error_reporting(0);  $user ='root'; $host = 'localhost'; $db = 'christcode'; $db_pass = '';  $con=mysqli_connect("$host","$user","$db_pass","$db");  // check connection if (mysqli_connect_errno($con))   {   echo "failed connect mysql: " . mysqli_connect_error();   }else{  $username = $_post['username']; $password = $_post['password'];   echo $username; echo $password; // insert data mysql  $sql="select * users username='".$username."' , password='".$password."' limit 1"; $result = mysqli_query($sql); echo $result;     if(mysql_num_rows($result) == 1)     echo"you validated user."; else     echo"sorry, credentials not valid, please try again."; } 

if(mysql_num_rows($result) == 1) 

should

if(mysqli_num_rows($result) == 1) 

you can't mix , match mysql_ , mysqli_ functions.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -