Re: Queries - Sometimes I need to use apostrophe, other times i don't
| From: | Richard Lynch | Date: | Fri, 19 Jul 2002 00:43:17 +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-108396@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.
You do not need apostrophes on INTEGER and FLOAT data.
Everything else needs them.
In fact, other SQL engines will complain if you put apostrophes on the
numeric data.
--
Like Music? http://l-i-e.com/artists.htm