Reply to Re: mySQL Problem

Your name:

Reply:


Posted by Steve on 11/08/07 14:29

"AnrDaemon" <anrdaemon@freemail.ru> wrote in message
news:628830764.20071108121442@freemail.ru...
> Greetings, Steve.
> In reply to Your message dated Wednesday, November 7, 2007, 20:19:23,
>
>
>> "Einstein30000" <dominic_ernst@web.de> wrote in message
>> news:1194453026.587359.180320@19g2000hsx.googlegroups.com...
>>> 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.

in that it currently doesn't work? is that all? it would help you be
understood better were you to allow a little more verbage than that. :)

>> 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.

as for 'anything else'. no, using reserved words as descriptives for db
objects (tables, columns, triggers, udf's, etc.) is such a huge no-no that a
dba would approach your boss and make a *strong* case for terminating your
ass. or, if you consult, a client thanking you for your time and parting
with your company in short order.

as for format? well, i'll be happy to one-line a couple of statistical
queries for you here. i'd venture a guess that if you can read it, you'd
have a shot at figuring out the calculations involved. if you don't (or
someone else with a question about it who can't simply read the query), then
i'd love to see you express to another person exactly where in the query you
don't get the actual logic that's going on. this is another reason to
format. 'hey, explain to me the calculation made on line 322.' that's v.
'hey, explain to me the calculations made near sum(avg(udf...no, not that
one...it's about the third one when your start at the top and search in your
editor for sum(avg(udf'. get the picture?

>> $sql = "
>> INSERT INTO main
>> (
>> `name` ,
>> `img` ,
>> `descr` ,
>> `from` ,
>> `size` ,
>> `format` ,
>> `cat` ,
>> `host` ,
>> `link` ,
>> `date`
>> )
>
> That way. All should work now.

until you forget what reserved words you've used and in which tables...or,
until you want (or your boss/client wants) to use another db. if you have a
large code base, how many man hours have you forced your employer to spend
fixing your (deliberate) oversight? hint, the larger the code base, the more
likely it is that you'll be looking for other means of income.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация