|
Posted by Darko on 11/07/07 19:23
On Nov 7, 6:19 pm, "Steve" <no....@example.com> wrote:
> well !!! lo-and-behold!!! when you get your error message back THIS time,
> you actually get a line number OTHER THAN 1 !!! now THAT would be helpful!
> imagine too, that you echo this out to the browser, copy it, and paste it
> directly into your mysql query browser...then execute it. even before then,
> you might have discovered (since you can now READ IT) that there is
> something wrong in the data you're inserting.
>
Having yelled that out, haven't you ever noticed that mysql (and so do
other
sql servers) specify precisely where the problem is - this time it
said:
> near 'from, size, format, cat, host ...
.... so it was quite clear that it had had problem with "from".
Considering php and
queries code readability you are, of course, right, since a programmer
will much more
easily read the code formatted in the way you have, but considering
error information,
sql servers are pretty precise about where the problem occurred, code
being indented
or not.
> don't let me throw you on that one...bad data is NOT the problem here. there
> are things called RESERVED WORDS. one of those would be the word 'FROM'...as
> in "select * FROM". if you had correctly formatted your sql statement, the
> line number in error would have been line 6...a much better clue.
As for rude yelling about making mistakes with reserved words, that is
something that happens
to many people, even experienced, from time to time, so no need to get
upset about it. I once
named two variables in C like "od" and "do", and couldn't find out
what was wrong with it until
I realised it was the "do" keyword.
Finally, it is not "reserved" word in any sql, as you can indeed name
any field "from", as long
as you make the parser know it. For an example, this is totally legal:
select name, img, descr, "from", size, format from table;
just as long as you keep the double quotes around key words.
Cheers
Navigation:
[Reply to this message]
|