php - Error while comparing data fetched from the table -


i not sure what's wrong, gives error message- error1: "notice: undefined index: user_type" , error2: "notice: undefined index: user_approved", while there exists table userdetails has columns name user_type , user_approved.

note: code may incomplete, has nothing error, have pasted code reference, concern error.

 if(isset($_post['login_btn'])){                  // define variables , set empty values                 $email = $pwd = "";                 $query1 = $result1 = "";                 $error = false;                 $usertype = $status = "";                 $combo = false;                  $email = validate_input($_post['user_name']);                 $pwd = validate_input($_post['user_pwd']);                  include_once("includes/connection.php");                  $query1 = "select * userdetails user_email='$email' , user_pwd='$pwd'";                  $result1 = mysqli_query($con,$query1);                  if (!$result1) {                     echo 'could not run query: ' . mysql_error();                     exit;                 }                 else{                     while($array1= mysqli_fetch_row($result1)){                         $combo=true;                         $usertype=$array1['user_type']; **//error1**                         $status=$array1['user_approved']; **//error2**                     };                 } 

mysqli_fetch_row return result row enumerated array

you can use mysqli_fetch_assoc

while($array1= mysqli_fetch_assoc($result1)){ 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -