调用未定义的函数MYSQL_NUM_ROWS()

时间:2016-07-11 12:16:41

标签: php

我正在尝试使用php验证登录但是收到此错误:

  

致命错误:未捕获错误:在/opt/lampp/htdocs/social/index.php:100中调用未定义的函数MYSQL_NUM_ROWS()堆栈跟踪:#opt {lamp}抛出/ opt / lampp / htdocs / social /第100行的index.php

这是我的代码

if(isset($_POST['login'])){

        $studentid = $_POST['studid'];  
        $pass = $_POST['password'];

        $query2 = mysqli_query($con, "SELECT * FROM members WHERE student_id = '$studentid' AND password = '$pass' ") or die (mysqli_connect_error());

        while($studid = mysqli_fetch_object($query2))
            {
            echo "$studid->member_id";
            }
            $numberOfRows = MYSQL_NUM_ROWS($query2);
            if ($numberOfRows == 0)
                {

                }
            else if ($numberOfRows > 0){
                    $wewness = mysql_query("SELECT * FROM members WHERE student_id = $studentid")or die(mysql_error());
                    $getid = mysql_fetch_array($wewness);
                    if($getid['account_status']==0){
                        $_SESSION['login'] = 'maybe';
                        $_SESSION['member_id'] = $getid['member_id'];
                        $_SESSION['studentid'] = $getid['student_id'];
                        header('location:registerexec.php');
                    }elseif($getid['account_status']==2){
                        $_SESSION['login'] = 'true';
                        $_SESSION['member_id'] = $getid['member_id'];
                        $_SESSION['studentid'] = $getid['student_id'];
                        header('location:hometest.php');

                    }elseif($getid['account_status']==1){
                        $_SESSION['login'] = 'maybe';
                        $_SESSION['member_id'] = $getid['member_id'];
                        $_SESSION['studentid'] = $getid['student_id'];
                        header('location:fill.php');

                    }
                }
            }

1 个答案:

答案 0 :(得分:13)

对于PHP 5以上的PHP版本,我们必须使用mysqli_ functions

ngAfterViewInit() {
//console.log('Generic Component...' + this.componentName + " Loading");
let componentIndex = this.keysRegister.indexOf(this.componentName);  
this.dcl.loadNextToLocation(this.typesRegister[componentIndex],this.target)
    .then(ref => { 
      ref.instance.componentModel = this.componentModel; 
    });  
console.log('Generic Component...' + this.componentName + " Loaded");
}