Hi,

Friday, March 26, 2004, 11:19:51 AM, you wrote:
dz> Hello,

dz> I'm creating registration service with this great form script for 
dz> creating forms within Smarty.

dz> Question is how can I validate 'username' against allready registered
dz> users in MySQL so that someone cannot register him self if there is
dz> another user with that username.

dz> TNX!


what I do is make that column unique and then check for mysql error
like this:

$error = '';
if($success){
 //output success message
else{
  $errnum = mysql_errno();
  switch($errnum){
    case 1062:
      $error .= 'This email address is already registered.<br>';
      break;
    default:
      $error .= mysql_error().' '.mysql_errno().'<br>';
      break;
  }
}

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to