Re: QuickForm - Validate username with mysql

From: Date: Fri, 07 May 2004 08:27:53 +0000
Subject: Re: QuickForm - Validate username with mysql
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12341@lists.php.net to get a copy of this message
Hi - You could write your own QuickForm-Rule which queries your user table, checks if the username exists. (perform an sql-query like this: "SELECT login from usertable where login=$val", count the entries int he resultset, check how much resultrows you get) If it doest not exist (0 values returned from db) - your return true else - you return false and display a customized errormessage Starting ponts: http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.addrule.php http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.registerrule.php Rememer that you need to register your new rule before you can assign it to the quickform element. If you absolutely cannot manage it yourself you could drop me an mail to xe at parkstudios dot net and I could send you some code i wrote for this purpose. Mr. Mansion & Crew: Maybe it would make sense to include a standard "uniqueid" rule based in pear_db or _mdb2 with the quickform package? Cheers, /Matthias

« previous php.pear.general (#12341) next »