Re: Help needed about queries with MySQL, thanks.
| From: | Jason Wong | Date: | Sun, 18 Aug 2002 09:53:47 +0000 |
| Subject: | Re: Help needed about queries with MySQL, thanks. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113128@lists.php.net to get a copy of this message | ||
On Sunday 18 August 2002 17:45, Jean-Marc Godart wrote:
> I have a MySQL database (called "sessions") with a auto-increment INT field
> called "sessionID". I try to check if there is already a record in this
> database with a given sessionID, which is called $sessionID in PHP. I use
> this query, which must be wrong (but I cannot find out why !!!) :
>
> SELECT * FROM sessions WHERE sessionID = $sessionID
>
> Even though there is already a record with the right sessionID, my program
> does not find it (I always get 0 when using mysql_num_rows() after the
> query). Though, if I replace "$sessionID" by, for example 4, then that
> works and it says there is already a record with that ID.
>
> I guess the problem comes from comparing two different kinds of variables,
> but I can't fix it ... Could anyone please help ? By advance, thank you !!!
Have you tried printing out $sessionID to see whether it contains what you
think it contains?
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Under capitalism, man exploits man. Under communism, it's just the opposite.
-- J.K. Galbraith
*/