Hi Guys. Again apologies for any glaring error here but im a self confessed noob!
I had a form to post to a database which worked fine but now isnt working since i added a username and password field???
Now im getting the error:
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 ''email,
tel,
sex,
username,
password`) VALUES (‘James Brown’, ‘15’, ’ at line 1
Below is the form post:
[php]
Name: |
|
Sorry for the length
and her is the file which should insert it into the database:
[php]<?php
if ($_POST[‘firstname’]!=""){
// Connects to your Database
require(“db_con.php”);
//Table Selected
mysql_select_db(“chaletpa_personals”,$dbhandle)
or die(“Could not select personals”);
//This is the directory where images will be saved
#$target = “customer_images/”;
#$target = $target . basename( $_FILES[‘image’][‘name’]);
#$ok=1;
//This gets all the other information from the form
$firstname=$_POST[‘firstname’];
$age=$_POST[‘age’];
#$pic=($_FILES[‘image’][‘name’]);
$email=$_POST[‘email’];
$tel=$_POST[‘tel’];
$sex=$_POST[‘sex’];
$myusername=$_POST[‘username’];
$mypassword=$_POST[‘password’];
// encrypt password
$encrypted_mypassword=md5($mypassword);
//Writes the information to the database
mysql_query(“INSERT INTO details (name
, age
, ‘email,
tel,
sex,
username,
password`)
VALUES (’$firstname’, ‘$age’, ‘$email’, ‘$tel’, ‘$sex’, ‘$myusername’, ‘$encrypted_mypassword’)”) or die(mysql_error()) ;
$message = “Thank you, you have now been added to our database!”;
}else{
$message = “You did not complete the form!”;
};
require (“incs/header.php”);
?>
require (“incs/footer.php”);
?>
[/php]
Any advise would be great as ive tried different syntax methods with the same result
Cheers in advance!