I'm trying to find if a user exists using this code:
$usercheck = "SELECT * FROM profiles WHERE username = '$user'";
$rs = mysqli_query($con,$usercheck);
$data = mysqli_fetch_array($rs, MYSQLI_NUM);
echo "<script> console.log('data=' + " . $data[0] . " + ''); </script>";
Data always returns 0 despite $user being equal to a name which already exists.
Any ideas?
var_dump()on$data, what is being returned by that query? What does$data[0]actually contain in the results?