When I submit the form to register a new user on my website, it submits, however it does not submit to the database and i'm getting an error saying this:
Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '####, 800800800)' at line 2 Whole query: mysql_query
Here is my MySQL Query:
$fname = $_POST['fnamein'];
$lname = $_POST['lnamein'];
$email = $_POST['emailin'];
$phone = $_POST['phonein'];
$password = sha1($_POST['passwordin']);
$query='INSERT INTO directoryi (Fname, Lname, password, email, phone)
VALUES ('.$fname.', '.$lname.', '.$password.', '.$email.', '.$phone.')';
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . mysql_query;
die($message);
}
echo '<h2>Thank you for registering!</h2>';
mysql_free_result($result);
mysql_close($dbconnect);
?>
And my HTML Form:
<form action="register.php" method='post'>
<input type="text" class="input-small" style="width: 46%;" name="fnamein" placeholder="First Name">
<input type="text" class="input-small" style="width: 46%;" name="lnamein" placeholder="Last Name">
<input type="text" class="input" style="width: 46%;" name="emailin" placeholder="Email">
<input type="text" class="input" style="width: 46%;" name="phonein" placeholder="ex. 7171234567">
<input type="password" class="input" style="width: 96%;" name="passwordin" placeholder="Password">
<button type="submit" class="btn">Register</button>
</form>