> -----Original Message-----
> From: ODCS [mailto:[EMAIL PROTECTED]
> Sent: 02 April 2003 08:10
>
> I have a form where the user inputs information - the code
> below is the
> error checking for one of the fields. The first IF statement
> just checks
> that the filed is not empty and works fine.
>
> Then I check a function I made to see if the user is already
> in a mysql
> database and the function returns 0, 1, or 2 depending on the various
> conditions. The first elseif works as I would expect - but it
> seems that the
> next two elseif's are just being ignored.
>
> Could someone possibly explain what I have wrong here. Thanks
>
> if (empty($form["name"])) { $error["name"] = "*"; $message["name"] =
> "Required field!";
> }
> elseif($duplicate = duplicate_name($form["name"]) == 0) {
This statement assigns the result of the comparison duplicate_name($form["name"]) == 0
to $duplicate (giving FALSE if this branch isn't executed, and so never satisfying the
tests for 1 or 2 below). I suspect that what you mean is:
elseif(($duplicate = duplicate_name($form["name"])) == 0) {
> $error["name"] = "*"; $message["name"] = "Screen name
> already used!";
> .
> }
> elseif ($duplicate == 1) {
> $error["name"] = "*"; $message["name"] = "Database error
> - Please try
> again in a few moments!";
> }
> elseif ($duplicate == 2) {
> $error["name"] = "*"; $message["name"] = "Server error -
> Please try
> again in a few moments!";
> }
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php