I make a register code email, user, pass and when I click in "zr" insert this info in database, but I'm getting following error:
MySQL error: Column count doesn’t match value count at row 1
Code:
include ('config.php');
include('login_css.php');
$error = "";
if (isset($_POST['zr'])){
$date = date("m d Y");
$user_name = strip_tags($_POST['user']);
$user_pass = strip_tags($_POST['pass']);
$user_email = strip_tags($_POST['email']);
$empty = strip_tags($_POST['none']);
$empty.= strip_tags($_POST['none']);
$empty.= strip_tags($_POST['none']);
$day = strip_tags($_POST['day']);
$month = strip_tags($_POST['month']);
$year = strip_tags($_POST['year']);
$dob = "$day/$month/$year";
if ($user_name == "") {
$error = "Firstname cannot be left empty.";
echo $error;
}
else if ($user_pass == "") {
$error = "Lastname cannot be left empty.";
echo $error;
}
else if ($user_email == "") {
$error = "Email cannot be left empty.";
echo $error;
}
//Check the username doesn't already exist
$check_username = mysql_query("SELECT yser FROM users WHERE username='$user_name'");
$numrows_username = mysql_num_rows($check_username);
if ($numrows_username != 0) {
$error = 'That username has already been registered.';
echo $error;
}
else
{
$check_email = mysql_query("SELECT email FROM users WHERE email='$user_email'");
$numrows_email = mysql_num_rows($check_email);
if ($numrows_email != 0) {
$error = 'That email has already been registered.';
echo $error;
}
else
{
//Register the user
$register = mysql_query("INSERT INTO users(user,pass,email) VALUES('','$user_name','$user_pass','$user_email','$date')") or die(mysql_error());
die('Registered successfully!');
}
}
}
?>
<!-- Form Mixin-->
<!-- Input Mixin-->
<!-- Button Mixin-->
<!-- Pen Title-->
<div class="pen-title">
<title>WebooHub - Join</title>
<h1>WebooHub - Join</h1>
</div>
<!-- Form Module-->
<div class="module form-module">
<div class="toggle"><i class="fa fa-times fa-pencil"></i>
</div>
<div class="form">
<h2>Create Your Account</h2>
<form action="u_register" method="POST">
<button>Join Now</button>
</form>
</div>
<div class="cta"><a href="login.php">Login?</a></div>
</div><strong></strong>