Re: Queries - Sometimes I need to use apostrophe, other times i don't
| From: | Asmodean | Date: | Wed, 17 Jul 2002 15:33:43 +0000 |
| Subject: | Re: Queries - Sometimes I need to use apostrophe, other times i don't | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108095@lists.php.net to get a copy of this message | ||
QUOTE//
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?
//QUOTE
Use apostrophes when $id is a string.
// Asmodean
asmodean@lka.nu