View Single Post

   
  #9 (permalink)  
Old 02-28-2008, 10:04 AM
Sanders Kaufman
 
Posts: n/a
Default Re: Syntax frustration

strawberry wrote:
> On Jan 31, 11:50 pm, Sanders Kaufman <b...@kaufman.net> wrote:
>> Jerry Gitomer wrote:


>>>> WHERE documents.DocPassportNationalty = countries.ConID
>>>> AND MemberID = $memberid;


>>>> MySQL 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 '' at line 1


>> No - don't do that.
>> Numbers should not be enclosed in quotes.

>
> you don't know that it's a number


I don't know that the sun will rise tomorrow, either, but I'll
bet you a PayPal dollar on it.

For one thing - the error that came back wasn't bitching about
that particular problem. There's a different error that comes
back for cast problems like that.

This one is a *syntax* error. That means that somewhere there's
a misspled word, an out-of-place comma, or an unclosed quote,
comma or parenthesis.

For another thing - ID's are like *always* numbers. Using the
AUTO_NUMBER feature to create PK's named "id" is just too THE
way to do it. If somebody does PK's in MySQL any other way -
I'd always suggest they do it this way, instead.

Indeed using that kind of PK instead of some string is probably
the easiest way to speed up queries and such - because numbers
are sooo NOT resource intensive to index.










Reply With Quote