вышеупомянутый поднятый запрос решается в следующем фрагменте кода;
if(isset($_POST['signup'])){
$username = ($_POST['username']);
$email = ($_POST['email']);
$password = ($_POST['password']);
$confirm_password = ($_POST['confirm_password']);
//form validation
if(empty($username)) {array_push($errors, "Username is required");}
if(empty($email)) {array_push($errors, "Email is required");}
if(empty($password)) {array_push($errors, "Password is required");}
if($password != $confirm_password) {array_push($errors, "Passwords do not match");}
if(strlen($password)<6){array_push($errors, "Password must be at least 6 characters long");}
if (!preg_match($password_requirements, $password) ) {array_push($errors,"Password must contain at least one upper case , one lower case and one digit" );}
//check db for existing user with same username
$check_username = "SELECT * FROM people WHERE username = '$username'";
$check_email = "SELECT * FROM people WHERE email = '$email'";
$res_username = db2_exec($db, $check_username);
$user_username = db2_fetch_assoc($res_username);
$res_email = db2_exec($db, $check_email);
$user_email = db2_fetch_assoc($res_email);
if(!empty($user_username)){
array_push($errors, "Username already exists!");
}
if(!empty($user_email)){
array_push($errors, "Email already exists!");
}
//register user if no error
elseif (count($errors) == 0) {
//$password = md5($password);
$query = "INSERT INTO people (username, email, password)
VALUES ('$username', '$email', '$password')";
db2_exec($db,$query) or die("couldn't execute query..".db2_stmt_errormsg());
$_SESSION['username']= $username;
$_SESSION['success']= "You are now logged in";
//echo "you are now logged in";
header('Refresh: 0; URL=index.php', true, 301);
}
}