Hi Mamot,
Here's a snippet of my code i use to check if a username is taken.
$query1 = mysqli_query($conn,"SELECT username FROM users2");
if ($result_1 = mysqli_fetch_array($query1)){
if($result_1['username'] === NULL){
$query2 = "SELECT * FROM $table_name WHERE username='$username'";
$result=mysqli_query($conn,$query2);
if(mysqli_num_rows($result) > 0){
echo 'Username is taken';
}else{
$query2 = "UPDATE $table_name SET username='$username'";
$result_2 = mysqli_query($conn,$query2);
echo 'Registration Successful';
}
}
}
I assume you are already familiar with this but feel free to ask anything and i'll try to answer.