mysql syntax error... has anyone experienced?
Posted: Thu May 06, 2010 8:58 am
In the last day mysql has been getting EXTREMELY picky.
I'm been using it for quite some time and it's never done this before so I don't really understand.
For example I will do:
SELECT field FROM table WHERE user='Me';
and I get an error like 'check your mysql syntax on line 1 near user)
?!?!
but if i do:
SELECT `field` from `table` where `user`='Me';
then it works fine.
it absolutely never was this picky before... and after looking at the docs i'm not even convinced the ` are correct mysql syntax???
this also caused an error in my php that was very weird.... i had a query like the above one, but it didn't give an error.... then when i was trying to compare the value from the database with a local variable .... nope. Why? I thought... so I added (after $row=mysql_fetch_asssoc(........) )
php printed out the entire row.... but instead of 'Me' for the value of user just ['user'] => ''
WHAT???????????
I couldn't believe it.
So I went to phpadmin and copied the EXACT query... returned the full row, WITH a value for user 'Me'.
What is going on........!!!!!!!!
Has anyone else had issues like this in the past?
I'm been using it for quite some time and it's never done this before so I don't really understand.
For example I will do:
SELECT field FROM table WHERE user='Me';
and I get an error like 'check your mysql syntax on line 1 near user)
?!?!
but if i do:
SELECT `field` from `table` where `user`='Me';
then it works fine.
it absolutely never was this picky before... and after looking at the docs i'm not even convinced the ` are correct mysql syntax???
this also caused an error in my php that was very weird.... i had a query like the above one, but it didn't give an error.... then when i was trying to compare the value from the database with a local variable .... nope. Why? I thought... so I added
Code: Select all
print_r ($row)php printed out the entire row.... but instead of 'Me' for the value of user just ['user'] => ''
WHAT???????????
I couldn't believe it.
So I went to phpadmin and copied the EXACT query... returned the full row, WITH a value for user 'Me'.
What is going on........!!!!!!!!
Has anyone else had issues like this in the past?