Link to home
Start Free TrialLog in
Avatar of balram sah
balram sah

asked on

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in

$check_email="select * form users where user email='$email'";
            $run_email = mysqli_query($con,$check_email);
      
            $check = mysqli_num_rows($run_email);
             
               if($check==1){
      
             echo "<script>alert('Email phone already exit,please try another!')</script>";
             exit();
Avatar of David Favor
David Favor
Flag of United States of America image

Why now just use SQL of...

SELECT COUNT(*) FROM users WHERE email='$email'

Open in new window


Same effect + must simpler to understand.

Be sure to add in error checking after each mysql API call too.
your select statement got error...

>> $check_email="select * form users where user email='$email'";

is "user email" a single field? if yes, then you should try:
$check_email="select * form users where `user email`='$email'";

Open in new window


or make necessary adjustment there
You did not check if the query was successful.
If it was not, then $run_email contains "FALSE".

HTH,
Dan
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.