Why not a select count(*) from user where username = $user If its > 0 then it is in use. or some sort of query against your user list.
Adam -----Original Message----- From: Will [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 1:57 PM To: DBI Users Subject: Can DBI be used to validate input? I am developing a registration area for a members site that will interface with a MySQL DB users table, and I ran into a problem. Note that I am using DBI as my DB Driver. Suppose the user tries to register with a username that has already been taken. I need a way to kick back an error message to them. I tried setting the username field in the usrs table to UNIQUE, so that might help if someone tried to insert something already taken... I was thinking that if MySQL kicks back an error message, then DBI might be able to recongize it in such a way that I could use the return value... I dont know if that is completely feasible though... there may be other, better ways anyway... so I'm all ears... Thanks, Will __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
