Bluehost.com Web Hosting $6.95

Syntax frustration

This is a discussion on Syntax frustration within the MySQL Database forums, part of the Database Forums category; On 1 Feb, 00:48, Sanders Kaufman <b...@kaufman.net> wrote: > This one is a *syntax* error. ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 02-01-2007
Captain Paralytic
 
Posts: n/a
Default Re: Syntax frustration

On 1 Feb, 00:48, Sanders Kaufman <b...@kaufman.net> wrote:
> 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.

Think this out a little more Sanders!

The query says
AND MemberID = something

The query parser is expecting "something" to be following the = sign.
That is the correct "syntax" for a WHERE clause.
If $memberid contains absolutely nothing, then the clause will end in

AND MemberID =

Which is incorrect syntax! The parser only sees the results after
variables are resolved, it has no way to know that they was at one
time a variable there which did not actually contain anything.

Try doing a query

SELECT * FROM table WHERE id =

in phpmyadmin and you'll get a syntax error not a cast error.

Reply With Quote
  #12 (permalink)  
Old 02-01-2007
Sanders Kaufman
 
Posts: n/a
Default Re: Syntax frustration

Captain Paralytic wrote:

> The query parser is expecting "something" to be following the = sign.
> That is the correct "syntax" for a WHERE clause.
> If $memberid contains absolutely nothing, then the clause will end in
>
> AND MemberID =


NULLs cause me sooooo much grief this way.
Reply With Quote
  #13 (permalink)  
Old 02-03-2007
nino9stars@yahoo.com
 
Posts: n/a
Default Re: Syntax frustration

> The query says
> AND MemberID = something
>
> The query parser is expecting "something" to be following the = sign.
> That is the correct "syntax" for a WHERE clause.
> If $memberid contains absolutely nothing, then the clause will end in
>
> AND MemberID =
>
> Which is incorrect syntax! The parser only sees the results after
> variables are resolved, it has no way to know that they was at one
> time a variable there which did not actually contain anything.



I have had this problem before too... If the code puts up a blank
entry for memberID, then it will give an error. Try outputting on the
screen what the actual query will be once it's passed.

The MySQL error usually tells you where the error in your syntax is
(at what point it breaks), and in this case it's complaining about an
empty entry at the end of the query...

Nino

Reply With Quote
  #14 (permalink)  
Old 02-05-2007
Martin Harran
 
Posts: n/a
Default Re: Syntax frustration


"Dan" <dp_pearce@hotmail.com> wrote in message
news:1170252373.333044.307720@k78g2000cwa.googlegr oups.com...
> I'm getting a syntax complaint with the following query
>
> SELECT documents.DocPassportFirstName,
> documents.DocPassportFamilyName,
> countries.ConNationality,
> documents.DocPassportNo,
> documents.DocPassportIssueDate,
> documents.DocPassportPlaceOfIssue,
> documents.DocPassportExpiryDate,
> documents.DocDLFirstName,
> documents.DocDLFamalyName,


Do your really mean to spell 'famiIy' as 'famAly' ?


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:13 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0