Hi All,
I have created a query in php. The idea is that the user enters search criteria into some (but not necessarily all) text fields on my form and the form gets posted to my PHP page containing this query:
I want the search results to be narrowed down more and more, based on the text in each field. For some reason I am getting records returned for fields where there shouldn't be a match. For example if I type "abc" in a field I am getting records containing "xyz" for the field, even though these records should be getting filtered out. Can anyone see what might be wrong with tis query to be causing this? I have been working on this for way too long.
Thanks in advance.
Ken
I have created a query in php. The idea is that the user enters search criteria into some (but not necessarily all) text fields on my form and the form gets posted to my PHP page containing this query:
PHP:
$query ="SELECT *
FROM tblequipissues
WHERE Location LIKE '%$Location%' OR '$Location' IS NULL AND
LocationNum LIKE '%$LocationNum%' OR '$LocationNum' IS NULL AND
EquipType LIKE '%$EquipType%' OR '$EquipType' IS NULL AND
UnitNo LIKE '%$EquipNum%' OR '$EquipNum' IS NULL AND
IssueDate LIKE '%$IssueDate%' OR '$IssueDate' IS NULL AND
FixedDate LIKE '%$FixedDate%' OR '$FixedDate' IS NULL AND
EnteredBy LIKE '%$EnteredBy%' OR '$EnteredBy' IS NULL AND
FixedBy LIKE '%$Assigned%' OR '$Assigned' IS NULL AND
CloseTicket LIKE '%$CloseTicket%' OR '$CloseTicket' IS NULL";
I want the search results to be narrowed down more and more, based on the text in each field. For some reason I am getting records returned for fields where there shouldn't be a match. For example if I type "abc" in a field I am getting records containing "xyz" for the field, even though these records should be getting filtered out. Can anyone see what might be wrong with tis query to be causing this? I have been working on this for way too long.
Thanks in advance.
Ken