php - check if user exists in mysql database and insert non-existing users -


i writing php script check if user exists in mysql database , if don't exists. inserted database. keep getting errors of know getting things wrong. can please!!!

$user = 'root'; $pass = ''; $db = 'xxx';  $conn = new mysqli('localhost', $user, $pass, $db) or die("unable  connect");  if($signup == "success"){ $conn = new mysqli('localhost', $user, $pass, $db) or die("unable  connect");     $sql = "select `rgeratable` (email,phoneno)    email=$email , phoneno=$phonenumber";      $result = $conn->query($sql);    $rowcount = mysqli_num_rows($result);    if($rowcount>=1){         echo "user email: ".$email." , phone number:    ".$phonenumber." exists!";    }else{        $sql2 = "insert `rgeratable`    (names,email,phoneno,resaddr,passw) values    ($name,$email,$phonenumber,$resaddr,$passw)";        $result2 = $conn->query($sql2);        if($result2===true){            echo "you have signed up!";        }else{            echo "error, signing up. please try again!";        }      }    } 

these errors:

  mysqli_num_rows() expects parameter 1 mysqli_result, boolean    given on "line in php script".    error, signing up. please try again! 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -