ELSE IF is not working correctly. Can u please correct my code and explain how its works. Thank you!
Here is my code php code.
<?php
include_once('config.php');
if(isset($_POST['username'])){
$username = $_POST['username'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$password = $_POST['password'];
if(strlen($password)<6){
exit ('Password must contain 6 symbols');
}
$password = md5($password);
$query ="INSERT INTO register(username,first_name,last_name,email,phone,password) VALUES ('$username', '$first_name', '$last_name', '$email', '$phone', '$password')"
or die(mysqli_error($connect));
if($result=mysqli_query($connect,$query)) {
echo '<h3><font color="red">You have successfully registered</font></h3>';
}else if (mysqli_num_rows($result)==0) {
exit("Username already exists");
}
}
?>
Aucun commentaire:
Enregistrer un commentaire