php - Catchable fatal error: Object of class mysqli could not be converted to string -
i trying create registration form project unfortunately got error while not find error in code!please me ride issue !
my code
<?php // file connected regform.php $firstname= $_post['firstname']; $lastname =$_post['lastname']; $email =$_post['email']; $password =$_post['password']; $confirmpassword =$_post['confirmpassword']; $address =$_post['address']; $balance =$_post['balance']; $password_hash = md5($password); $bookconn = mysqli_connect("localhost", "root","", "bookstore") or die("wrong execution"); $querys = "select email customer"; $resultsq = mysqli_query($bookconn , $querys); $flag=0; while($row=mysqli_fetch_array($resultsq)) { if($email == $row['email']) { $flag=1; } } if($flag==0) { if($password == $confirmpassword) { $query = "insert user (firstname , lastname ,email , password , address , balance )values('".$firstname."', '".$lastname."' ,'".$email."' , '".$password_hash."', '".$address."' , '".$balance."')"; $result = mysqli_query($bookconn , $query) or die($bookconn); if ($result) { echo "successfuly registered"; } else { echo "something went wrong!"; } } else{ echo "passowrd not match!"; } } else{ echo "email existed in database!"; } mysqli_close($dbc); ?>
there 2 error seems in code:-
mysqli_close($dbc)
. never created$dbc
in code. mustmysqli_close($bookconn)
.you need modified last
mysqli_query
this:-$result = mysqli_query($bookconn , $query) or die(mysqli_error($bookconn));
note:- hope doing these changes rid of proble. thanks.
Comments
Post a Comment