Hi, below is snippet of code for registration, every thing works ok, however i get --- Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in---
at the check where we check if user already exists...
i no its a query issue however is this a common error? and is there a quick solution...
*------------------------------------------------------------------------------------------------------------
function checkUser() {
$connection = connectDB();
$check = "SELECT * FROM users WHERE user_name = $username";
$result2 = @mysql_query($check, $connection);
$item = array();
while ($row = mysql_fetch_array($result)) {
$item[] = $row;
}
disconnectDB($connection);
return $item;
}
//error checking
if (empty($fname) || empty($pass1) || empty($pass2) || empty($usertype) || empty($DOB) || empty($email) || empty($sex) || empty($lname) || empty($username)) {
header("Location: fields-missing.html");
exit;
}
checkUser();
if ($pass1 != $pass2) {
header("Location: pass-nomatch.html");
exit;
} else if ($item[0] == null) {
header("Location: already-exists.html");
echo $item[0];
exit;
} else {
addUser($fname, $lname, $username, $pass1, $usertype, $DOB, $email, $sex);
// Email password and login for register-exec
header("Location: index.html");
}