Re: Checking database for a value
| From: | Intruder | Date: | Sat, 20 Apr 2002 17:16:07 +0000 |
| Subject: | Re: Checking database for a value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93824@lists.php.net to get a copy of this message | ||
DLM> I have a field userid which the user fills in at registration. Before
DLM> entering the data into the database, I want to check if the userid exists in
DLM> the database.
You have to SELECT that user from the table you store your users:
SELECT userid, name , etc FROM table WHERE userid='$your_id'
if *_num_rows() > 0 then he is already in, otherwise you can add him:
INSERT ..... INTO table ....
Enjoy!