Queries - Sometimes I need to use apostrophe, other times i don't

From: Date: Wed, 17 Jul 2002 15:19:50 +0000
Subject: Queries - Sometimes I need to use apostrophe, other times i don't
Groups: php.general 
Request: Send a blank email to php-general+get-108093@lists.php.net to get a copy of this message
When running a mysql_query, sometimes i need to have apostrophes surrounding variables...other times i don't example... $query = "SELECT * FROM table WHERE id='$id'"; or $query = "SELECT * FROM table WHERE id=$id"; ...it kinda seems random when it wants apostrophes and when it doesn't want them. Any ideas?

« previous php.general (#108093) next »