Re: Select where
| From: | ben | Date: | Tue, 20 Mar 2001 14:24:49 +0000 |
| Subject: | Re: Select where | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7642@lists.php.net to get a copy of this message | ||
On Wed, 21 Mar 2001, boclair wrote:
> This is simple but I cannot see where I am going wrong
>
> I have a table members with one of the fields
> status, varchar(10)
>
> The values may be active or retired or deceased or null
>
> If I run the select
>
> SELECT * FROM members WHERE status = 'deceased';
>
> I get MySQL said: You have an error in your SQL syntax near
> '\'deceased\';' at line 1
>
> Will somebody show me the correct syntax
>
> Tim Morris
>
>
>
you need to pass the quotes to mysql, hence you have to backslash them in
the php code. Try :
$query="SELECT * FROM members WHERE status = \"deceased\"";
--
Ben
History is curious stuff You'd think by now we had enough Yet the fact
remains I fear They make more of it every year.