RE: [PHP] Database Error
| From: | Navid Yar | Date: | Wed, 06 Mar 2002 18:57:50 +0000 |
| Subject: | RE: [PHP] Database Error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87662@lists.php.net to get a copy of this message | ||
I changed mysql_db_query() to mysql_query(). I took the quotes away from
the id. It still gives me an error:
Error in query: SELECT label FROM menu WHERE id = 3
Where else could I be going wrong?
-----Original Message-----
From: Jason Wong [mailto:php-general@gremlins.com.hk]
Sent: Thursday, March 07, 2002 4:36 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Database Error
On Wednesday 06 March 2002 18:27, Navid Yar wrote:
> I'm thinking that it probably has to do with the quoting scheme or
> something else. I tried it on the command line, and it worked fine. I
> don't even think it matters what types of quotes I use around the id
> field. I tried both (single and double) on the command line, and it
> worked just fine. In other words, the SQL is fine, and there's nothing
> wrong with it. It must either be how I placed the sql statement into
the
> query or how the class is executed. I'm not sure. It might entirely be
> something else. But, any help on this is really appreciated.
If 'id' is a numeric field then you should not use quotes:
SELECT label FROM menu WHERE id = 1
If it's a character field then it doesn't matter whether you use single
or
double quotes.
One thing you could try doing is to rewrite your code so that it doesn't
use
mysql_db_query() as it has been deprecated as of php-4.0.6.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
If Patrick Henry thought that taxation without representation was bad,
he should see how bad it is with representation.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php