I’m just wondering what kind of SQL command I could execute that would select all items from a certain table where column A is not equal to x and column B is not equal to x
Something like:
select something from table
where columna does not equal x and columnb does not equal x
Any ideas?
The key is the sql query, which you will set up as a string:
Note that there are a lot of ways to specify NOT. Another one that works just as well is:
Here is a full example of how to use it:
You can do whatever you would like within the above while loop. Access each field of the table as an element of the
$row arraywhich means that$row['field1']will give you the value forfield1on the current row, and$row['field2']will give you the value forfield2.Note that if the column(s) could have
NULLvalues, those will not be found using either of the above syntaxes. You will need to add clauses to includeNULLvalues: