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. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
> 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 |
|
|||
|
"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' ? |