Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>May be this can work. You can try this:</p> <pre><code> &lt;?php if ($_POST['submit']) { $errormsg = ""; $name = isset($_POST['name'])?$_POST['name']:NULL; $password = isset($_POST['password'])?$_POST['password']:NULL; $password2 = isset($_POST['password2'])?$_POST['password2']:NULL; $email = isset($_POST['email'])?$_POST['email']:NULL; $phone = isset($_POST['phone'])?$_POST['phone']:NULL; //Try by removing @, since it ignores any error that may occur here while connecting to mysql $connection = mysqli_connect("$hostname","$username", "$password", "$database"); if(!$connection) die("&lt;p&gt;The database server is not available.&lt;/p&gt;".mysqli_error()); echo "&lt;p&gt;Sucessfully connected to the database server.&lt;/p&gt;"; if(empty($name)||empty($password)||empty($password2)||empty($email)||empty($phone)) { // Checks if all inputs are filled $errormsg = "Please insert the required fields below&lt;br /&gt;"; if ($name == "") $errormsg = $errormsg . "Enter a name.&lt;br /&gt;"; if ($password == "") $errormsg = $errormsg . "Please enter a password.&lt;br /&gt;"; if ($password2 =="") $errormsg = $errormsg . "Please re-enter your password.&lt;br /&gt;"; if ($email =="") $errormsg = $errormsg . "Please enter an email address.&lt;br /&gt;"; if ($phone =="") $errormsg = $errormsg . "Please enter a phone number.&lt;br /&gt;"; if($errormsg) echo "$errormsg"; } if($password != $password2) $errormsg = $errormsg. "Your passwords must match!&lt;br/&gt;"; function checkEmail($email) { //begin email check function $sql = "SELECT count(email) FROM CUSTOMER WHERE email='$email'"; $result = mysql_result(mysqli_query($connection,$sql),0);//see the difference if( $result &gt; 0 ) $errormsg = $errormsg. "There is already a user with that email!"; }//end email check function if(!$errormsg) { $insertquery = "INSERT INTO CUSTOMER (customer_no, name, password, email, phone) VALUES(NULL, '$name', '$password', '$email', '$phone')"; $queryresult = mysqli_query($connection,$insertquery);//see the difference if($queryresult) echo("&lt;br&gt;Registration sucessful"); else echo("&lt;br&gt;registration was not sucessful"); } } } ?&gt; </code></pre> <p>You can learn more from <a href="http://www.php.net/manual/en/book.mysqli.php" rel="nofollow">here</a>. Enjoy!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload