Adam Anderson Adam Anderson - 4 years ago 74
MySQL Question

Is this the correct syntax for a mysql query

Im trying to pull an array from a mysql table and put it into a html table. I can do this successfully but when i try and add the restriction != null, no data is returned.

$query = mysqli_query($link, "select * from timetable Where id = $id and Subject != NULL");

Answer Source

Don't use equality operator with NULL. You should use IS NULL or IS NOT NULL
Example:

Subject IS NOT NULL
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download