Stephane Perennes (71 91, Mascotte)
On Fri, 7 Feb 2003, Steve Sapovits wrote: > > 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... You may well use the error code of the interface, but that mean checking the error return code and doing stuff .. I would rather use erro codes for real error, meaning that in order to check if a login exist i would probably perform a select first. Just a question of taste .. inserting a post-checking save one sql call, but it's rather ugly.
