Re: Programming the Hard Way?

From: Date: Sun, 28 Jan 2001 04:31:14 +0000
Subject: Re: Programming the Hard Way?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37087@lists.php.net to get a copy of this message
"[ rswfire ]" <rswfire@hotmail.com> wrote" > Am I programming the hard way? > mysql_query("SELECT * FROM table WHERE id='".$id."'"); > > Could I just do this? > mysql_query("SELECT * FROM table WHERE id='$id'"); Yes. And if $id is always numeric you could simplify it even more. Quotes are only needed around strings. They aren't needed around numbers. If you surround a number in quotes it's treated as a string which will result in different behavior when doing sorting and > or < comparisons. mysql_query( "SELECT * FROM table WHERE id=$id " ); -- Steve Werby COO 24-7 Computer Services, LLC Tel: 804.817.2470 http://www.247computing.com/

« previous php.general (#37087) next »