View Single Post
  #1 (permalink)  
Old November 30th, 2003, 11:30 AM
goatboy goatboy is offline
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Function not returning anything...

Can someone tell me why, when I call this function with "checkUserDb($user);" it's not returning anything for $matched ?
Am I missing something, because it makes no sense to me.


function checkUserDb($submittedName) {
    global $hostname, $username, $password, $dbName;

    if (!($connection = @ mysql_connect($hostname,$username,$password))) {
        die("Could not connect to host.");
    }

    if (!(mysql_select_db($dbName, $connection))) {
        die("Could not connect to database.");
    }

    $nameQuery = mysql_query("SELECT * FROM db_users");
    while ($checkRow = mysql_fetch_array($nameQuery)) {
        $formName = $checkRow['user'];
        if ($submittedName == $formName) {
            $matched = "yes";
            break;
        }
        else {
            $matched = "no";
        }
    }

    mysql_close($connection);
}


If only stupidity was painful...
Reply With Quote