Re: Checking database for a value
| From: | Jason Wong | Date: | Sat, 20 Apr 2002 17:14:59 +0000 |
| Subject: | Re: Checking database for a value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93828@lists.php.net to get a copy of this message | ||
On Sunday 21 April 2002 01:10, Jason Wong wrote:
> On Sunday 21 April 2002 00:55, Denis L. Menezes wrote:
> > hello friends,
> >
> > I am looking into 4 books in front of me but somehow cannot find the
> > following :
> >
> > I have a field userid which the user fills in at registration. Before
> > entering the data into the database, I want to check if the userid exists
> > in the database.
> >
> > Can someone tell me the name of the function I must use, I will look for
> > the rest in the php dictionary.
>
> AFAIK there are no built-in functions to do that. You need to run a query
> like "SELECT userid FROM table" then see whether any rows are returned. If
> you use this often you can wrap it up in a function.
That of course should be:
"SELECT userid FROM table WHERE userid='user_id_to_check'"
I better get some sleep :)
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Delta: We never make the same mistake three times. -- David Letterman
*/