[SOLVED] Finding out if a row exists
Posted: Mon Nov 17, 2003 6:25 am
I'm creating my first membership script with PHP (using a MySQL database) and I've stubled across a smal problem and can't find the answer anywhere (although I'm sure it's pretty simple).
If a member wants a username (which is set to be unique) that is the same as a current member, the following error gets returned:
Error: Duplicate entry 'desiredusername' for key 1
How can I check if there is already a row in a table with desiredusername as a username before trying to create the row? A function returning TRUE or FALSE is what I'm really looking for.
Thanks in advance,
Rupe
If a member wants a username (which is set to be unique) that is the same as a current member, the following error gets returned:
Error: Duplicate entry 'desiredusername' for key 1
How can I check if there is already a row in a table with desiredusername as a username before trying to create the row? A function returning TRUE or FALSE is what I'm really looking for.
Thanks in advance,
Rupe