search

Home  >  Q&A  >  body text

Login function error

Fatal error:  Call to undefined function mysql_num_row() in E:\phpStudy\WWW30\daima\login_a.php on line 33

if(mysql_num_row($result)==0){

This is the sentence, the following is the complete code

<?php

session_start() ;

$username=$_POST["username"];

$password=$_POST["password"];

include("config.php");

if(empty($username)){

echo ("<script type='text/javascript'> alert('Username cannot be empty');history. go(-1);</script>");

}

if(empty($password)){

echo ("<script type= 'text/javascript'> alert('Password cannot be empty');history.go(-1);</script>");

}

//echo $username.$password;

$db=mysql_connect("127.0.0.1","root","root");

mysql_select_db("performance",$db);

mysql_query("SET NAMES 'GB2312'");

$_POST["username"];

$sql="select * from admin where admin_name='$username' and admin_pw='$password'";

$result=mysql_query($sql);

//$number = mysql_fetch_row($result);

//$result=mysql_fetch_array(mysql_query($sql));

if(mysql_num_row($result)== 0){

echo ("<script type='text/javascript'> alert('The username or password is incorrect! ');history.go(-1);</script>");

mysql_close();

exit;

}else{

$_SESSION["admin"]="lee";

echo "<script>location.href='Admin.html';</script>";

}

?>

jimwaajimwaa1354 days ago1293

reply all(1)I'll reply

  • 灭绝师太

    灭绝师太2021-04-21 09:45:25

    print_r(get_extension_funcs('mysqli'));

    is mysqli_num_rows(), the function name is wrong. Be careful~

    reply
    0
  • Cancelreply