Jump to content

Simple POST Help


Bradley99

Recommended Posts

First Date:

edition=1 - news=This is my article - title=Titlee - by=BradleyYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by, date) VALUES ('1', 'This is my article', 'Titlee', 'Bradley', '2011-01-27 03' at line 1

 

Second date: Same again. . .  .

The problem isn't likely the date as much as the fact that 'by' is a MySQL reserved word. You need to enclose it in `backticks` to use it as a table or field name.

 

A good indication is the error message:

for the right syntax to use near 'by, . . .

actually I remember having this problem before with an ordering system and the column name order, for simplicity I just changed the name of the column, on what Pikachu says it would be like this then for it to work

 

$query =("INSERT INTO paper (edition, news, title, `by`, date) VALUES ('$edition', '$news', '$title', '$by', '$date')");

 

if that still causes issues consider changing the column by to another name

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.