Page 2 of 2
Posted: Sun Aug 26, 2007 1:52 pm
by miro_igov
There is no need of single quotes if the id does not contain any special characters like space, quotes, \r, \n etc.
it is legal to use
Code: Select all
$query = "SELECT * FROM `news_posts` WHERE newstype=test";
Posted: Sun Aug 26, 2007 2:13 pm
by Zoxive
Code: Select all
mysql>SELECT * FROM `news_posts` WHERE newstype=test;
ERROR 1054 (42S22): Unknown column 'test' in 'where clause'
Posted: Sun Aug 26, 2007 8:29 pm
by Benjamin
miro_igov wrote:it is legal to use
Code: Select all
$query = "SELECT * FROM `news_posts` WHERE newstype=test";
No it isn't.
Reply
Posted: Mon Aug 27, 2007 7:29 am
by user___
miro_igov wrote:
it is legal to use
php:
$query = "SELECT * FROM `news_posts` WHERE newstype=test";
No it isn't.
NOTE:Even if you have only an id column whose type is integer(long, etc.) and although it is legal(syntactically only) it is a very bad practice.
Posted: Mon Aug 27, 2007 9:05 am
by miro_igov
Hmm yes, it is illegal, sorry.