Page 1 of 1

Search Query Problem with MySQL and DWMX

Posted: Fri Aug 08, 2003 4:22 pm
by theoph
This is my query that I'm having problems with

Code: Select all

SELECT laos.`last`, laos.`first`, laos.gender
FROM laos
WHERE laos.gender = 'xGender' AND laos.`last` LIKE 'xLast%'
ORDER BY laos.`last`
My variables are:

Code: Select all

xGender with a default value of 1 and a runtime value of $HTTP_GET_VARSї'searchGender']
xLast with a default value of 1 and a runtime value of $HTTP_GET_VARSї'searchLast']
Problem
When I do the search it only works when I have information in both variables or in searchGender only. If I have information only in searchLast my find search returns no records. See the query example below when I had the variable $query_rsLD to display it's content.

Code: Select all

SELECT laos.`last`, laos.`first`, laos.gender FROM laos WHERE laos.gender = '' AND laos.`last` LIKE 'mccowan%' ORDER BY laos.`last`
Notice how laos.gender = '', I think it should read laos.gender = '%%' but it's not.

What's wrong here?

-Dave