how to handle sql reserved word?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

how to handle sql reserved word?

Post by jaylin »

in php, i dun know who to handle sql reserved word in the query string. plz tell me.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

you are going to have to be more specific. if you want to use a sql reserved word in a mysql query then just put it in the query.
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

Post by jaylin »

for example my table name is "SELECT" and my field name is "FROM", so, wht i should do?
shiznatix wrote:you are going to have to be more specific. if you want to use a sql reserved word in a mysql query then just put it in the query.
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

put back-ticks round the table name and field name ie.

Code: Select all

SELECT `FROM` FROM `SELECT`
That's seriously going to confuse you when you go back to edit your code though. Why would you name your tables this way?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Sounds like school work :P
Post Reply