Re: Queries - Sometimes I need to use apostrophe, other times idon't
| From: | 1LT John W. Holmes | Date: | Wed, 17 Jul 2002 15:38:30 +0000 |
| Subject: | Re: Queries - Sometimes I need to use apostrophe, other times idon't | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108096@lists.php.net to get a copy of this message | ||
It's not random. Strings need to be enclosed. You can use single or double
quotes, but you have to use them.
---John Holmes...
----- Original Message -----
From: "Phil Schwarzmann" <pschwar@jhmi.edu>
To: <php-general@lists.php.net>
Sent: Wednesday, July 17, 2002 11:19 AM
Subject: [PHP] Queries - Sometimes I need to use apostrophe, other times
idon't
> 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?
>