Can you spot the error?

I have a query that will not insert! I know I am doing something wrong but I can’t see it.

[code]mysql_connect(“localhost”, “root”, “fakepassword”) or die(mysql_error());
mysql_select_db(“orderboard”) or die(mysql_error());

// Insert a row of information into the table
$query = “INSERT INTO order (r_fname, r_lname, r_descript, r_quantity, r_website, r_date, r_status, r_po ) VALUES (‘jason’,ellis’,‘Pencil Cup’,‘12’,‘www.yahoo.com’,‘12/23’,‘pending’,‘00000’)”;
mysql_query($query) or die(mysql_error()); [/code]

Here is the error I am getting:
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 ‘order (r_fname, r_lname, r_descript, r_quantity, r_website, r_date, r_status, r_’ at line 1

[php]
mysql_connect(“localhost”, “root”, “fakepassword”) or die(mysql_error());
mysql_select_db(“orderboard”) or die(mysql_error());

// Insert a row of information into the table
$query = “INSERT INTO order (r_fname, r_lname, r_descript, r_quantity, r_website, r_date, r_status, r_po ) VALUES (‘jason’,ellis’,‘Pencil Cup’,‘12’,‘www.yahoo.com’,‘12/23’,‘pending’,‘00000’)”;
mysql_query($query) or die(mysql_error());
[/php]

Syntax highlighting using the [php] tags instead of [code] tags helps us all ;)

As for your query, the only thing I can see that’s wrong with it, is that I’m missing a ’ just before ellis’ in the VALUES section. If that doesn’t fix the problem, try echoing your query, so you know what it looks like.

Yup i agree with Zyppora

Sponsor our Newsletter | Privacy Policy | Terms of Service