Hello I need to select all the NULL records in my database which have the column called "cliente_pretenece"
The problem is that I can't define it inside the sql query using IS NULL, because I am using different criteria’s for select, here is the select code:
$sql = "SELECT * FROM users WHERE 1";
if (!empty($id)) {
$sql .= " AND userID = '$id' ";
}
if (!empty($telefono)) {
$sql .= " AND telefono LIKE '%$telefono%' ";
}
if (!empty($cliente_pretenece)) {
$sql .= " AND cliente_pretenece = '$cliente_pretenece' ";
}
the column cliente_pretence will always have 3 different states, and the select code from whch the call is coming is:
<select>
<option value="SDQ">State 1</option>
<option value="SA">State 2</option>
<option value="NULL">Nothing</option>
</select>
So any help will be very welcome. Thanks