Hrms.  Got a small problem.

I'm now using functions on a regular basis, but I've come to another
sticking point with them:  returning multiple variables from the function...

Here's a really quick example (nothing to do with what I intend to use the
functions for):

function CUP ($connection,$username,$password) {

    if (($username) && ($password)) {
        $sql = "SELECT username, password FROM table
            WHERE username = '$username' AND password = '$password'";
        $result = etc etc
        $num = mysql_numrows($result);

        if ($num != 0) {
            $valid = "yes";
        }

    return $valid;

}



$correct_user = CUP ($connection,$username,$password);

Now, if the user is correct, I'd get a return of

$correct_user = "yes";

What if I wanted to "return" more than one variable from the function?  And
how would I assign it a name?  Like the actual variable, or is that just not
possible?

I've tried
return $var1,$var2;
But got an error.

As always, tia :)

James.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to