I am trying to insert user records into the database using PHP. After insert records, it displays success or error message. It shows me success message but data did not store into the database. How can I display MySQLi errors in PHP?
I am following this code:
<?php $sql=mysqli_query($con,"INSERT INTO `Table Name`(`field1`,`field2`)VALUES('$variable1','$variable')"); if($sql){ echo "success"; }else{ echo "error"; } ?>
Question and answer is powered by AnsPress.io