Problems with inserting into the database

My code is below

[code]$query = "INSERT INTO data (first name, last name, street, town, city, postcode, country, email, phone,

password) VALUES (’$first_name’,’$last_name’,’$street’, ‘$city’, $postcode’, ‘$country’, ‘$email’, ‘$ph’,

‘$password’);";
$query = mysql_query($query) or die(mysql_error());[/code]

But when I use the form to write the variables I get the error below.

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 'name, last name, street, town, city, postcode, country, email, 

I know that the field names and the same I just dont no why they are not entering. If someone could help it would be great!

At first glance, I would definately say get rid of the spaces, they always casue problems. And you can tell that the query has stopped right after the first space found…
try using a “_” instead of " ".

In your DB column name as well as the query. :)

Sponsor our Newsletter | Privacy Policy | Terms of Service