Re: mySQL Problem



Greetings, Steve.
In reply to Your message dated Wednesday, November 7, 2007, 20:19:23,


"Einstein30000" <dominic_ernst@xxxxxx> wrote in message
news:1194453026.587359.180320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

in one of my php-scripts is the following query (with an already open
db-connection):

$q = "INSERT INTO main (name, img, descr, from, size, format, cat,
host, link, date) VALUES ('$name', '$img', '$descr', '$user', '$size',
'$format', '$cat', '$host', '$link', '$date')" or die(mysql_error());

And when the query gets executed i get back the following 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 'from, size, format, cat, host, link, date) VALUES ('bla', '-',
'keine', 'Holgi',' at line 1

Whats wrong here?!

your sql statement is F.U.C.K.E.D !!!

Agree but not in the way You think about.

hmmmm...perhaps you'll now see the
value in FORMATTING your queries where a HUMAN BEING can read it. makes it
easier to debug. :)

Actually, problem is proper quoting, not the format or anything else.

$sql = "
INSERT INTO main
(
`name` ,
`img` ,
`descr` ,
`from` ,
`size` ,
`format` ,
`cat` ,
`host` ,
`link` ,
`date`
)

That way. All should work now.


--
Sincerely Yours, AnrDaemon <anrdaemon@xxxxxxxxxxx>

.



Relevant Pages

  • mySQL Problem
    ... in one of my php-scripts is the following query (with an already open ... And when the query gets executed i get back the following error: ... You have an error in your SQL syntax; ...
    (comp.lang.php)
  • Re: mySQL Problem
    ... And when the query gets executed i get back the following error: ... You have an error in your SQL syntax; ... corresponds to your MySQL server version for the right syntax to use ...
    (comp.lang.php)
  • Re: mySQL Problem
    ... And when the query gets executed i get back the following error: ... You have an error in your SQL syntax; ... I format my query: ... I use the MySQL error tools to help find the problem. ...
    (comp.lang.php)
  • Re: formatting a calculated number field on a form
    ... > A query in an MDB file CAN call a user-defined function. ... > function name is Age and it returns a double. ... The user will certainly "notice" if a patient was born on Jan ... I just want control over the *display format* of a number ...
    (microsoft.public.access.forms)
  • RE: Query count then average.
    ... What was happening in my database was the query returned the ... "Ken Sheridan" wrote: ... It probably depends where you set the Format property. ... "Robert F." ...
    (microsoft.public.access.queries)