I am having a problem with what I would have thought would have been a simple query. I have database where all field data is numbers. I only want the results to show those records where the number in the field is greater than 4
What I have been trying is:
$query = "SELECT * FROM table WHERE field1 > '4' ";
I have tried without the quotes
eg; $query = "SELECT * FROM table WHERE field1 > 4 ";
I get No results using this.
NOTE: I also do not want to show the results of empty fields (fields with no data) for testing to show only fields with data I tried:
$query = "SELECT * FROM table WHERE field1 != '' "; While this does show the results it also shows the empty fields (fields with no data).
So I am assuming maybe I need to use AND in my query so something like:
In Words: Select from Table where Feild1 is not empty AND greater then 4
Code: $query = "SELECT * FROM table WHERE field1 != '' AND > 4 ";
If someone could give me an example of the code I would use to do this It would Be greatly appreciated. Thank You all In advance for any help you can offer.