Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to undefined function MYSQL_NUM_ROWS() [duplicate]

Tags:

php

i am trying to validate a login with php but am getting this error :

Fatal error: Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in /opt/lampp/htdocs/social/index.php:100 Stack trace: #0 {main} thrown in /opt/lampp/htdocs/social/index.php on line 100

here is my code

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');

                    }
                }
            }
like image 578
Benjamin Gakami Avatar asked Jul 11 '16 12:07

Benjamin Gakami


1 Answers

For the PHP version above php 5 we have to use mysqli_ functions

mysqli_num_rows()
like image 194
Rajkumar R Avatar answered Oct 13 '22 00:10

Rajkumar R