Я не могу заставить if ($register_user_name != $check_name){
работать, но вложенное, если staement работает должным образом.
<?php
//al the default code to connect to mysql
include("../sql_information.php");
class infos{
//the var that will store my sql query
private $db;
function login_details($queryresult) {
//this runs the imported script
$this->db = new MySQLDatabase();
$register_user_name = $_POST['register_user_name'];
$register_password = $_POST['register_password'];
$confirm_password = $_POST['confirm_password'];
//This is my mysql search query
$sql = "SELECT user_name FROM `data_manager`.`user_accounts`;";
//the result of the query is stored in this var
$queryresult = $this->db->query($sql);
//I dont know what I did here
if ($result = $this->db->fetchArray($queryresult)) {
$answer = $result['id'];
$check_name = in_array($register_user_name, $answer);
if ($register_user_name != $check_name){
if ($register_password == $confirm_password) {
$sql = "INSERT INTO `data_manager`.`user_accounts` (`id`, `user_name`, `password`) VALUES (NULL, '$register_user_name', '$register_password');";
mysql_query($sql);
echo "Registration Complete !";
} else {
print "The password you entered does not match, please retry.";
}
} else {
print "This username is already being used !";
}
}
}
?>