PDA

View Full Version : Quotes in the Query


Saj
07-08-2003, 03:55 AM
I have recently found that different types of quotes work for me...

Basicly when should quotes be used, like ` or ', and how?

Thanks

Jeewhizz
07-08-2003, 04:45 AM
backquotes should be used to quote a table, field or database name:

SELECT `table`.`field`,`table2`.`field`FROM `table`,`table2`

You use the normal single quotes when you are quoting a varialbe in PHP for example:

SELECT `table`.`field`,`table2`.`field`FROM `table`,`table2` WHERE `table`.`field` = '$variable'

Jee

Spookster
07-08-2003, 07:44 AM
Originally posted by Jeewhizz
You use the normal single quotes when you are quoting a varialbe in PHP for example:


only if that variable is suppose to be a string otherwise you should not quote it.

Jeewhizz
07-08-2003, 12:04 PM
Cheers bud ;)

Saj
07-09-2003, 01:22 AM
Cool. Thanks for clearing that up for me :thumbsup: