Cannot select all data from a table php/sql $sql = $conn-&gt;prepare('SELECT * FROM users WHERE user_id != null');
if($sql-&gt;rowCount() &gt; 0){
}
else{
echo "there are no users"
}


I want to select all data from a table however the code above does not work. It echoes/prints out "there are no users." No errors are shown too.
user_id != NULL


always fails.  Instead, say

user_id IS NOT NULL


And you need to -&gt;execute it.