Hi all,
I have created a search page which looks at three recordsets, and checks their attributes against what the user has input in a text box.
One of the searches checks against a customers first and last name, so if I typed in 'Joe' ot 'Bloggs' then it would find the customer 'Joe Bloggs', but I can't figure out how to search for he customer Joe Bloggs when both his first and last name are input into the text box.
My search query is simple:
SELECT Customer_ID, Customer_Fname, Customer_Lname, Customer_Postcode, Customer_Email
FROM customer
WHERE Customer_Fname LIKE '$HTTP_POST_VARS[searchtext]' OR Customer_Lname LIKE '$HTTP_POST_VARS[searchtext]' OR Customer_Email LIKE '$HTTP_POST_VARS[searchtext]' OR Customer_Postcode LIKE '$HTTP_POST_VARS[searchtext]'
Is there something I can do to get it to send back a result if it is in the Customer_Fname or Customer_Lname?
Also, when I use the % sign in the query, it shows all teh records when the user first gets to the search page, when no search criteria has been entered, is there anyway of stopping this from happening apart from jumping to a new page to show the results?
Thank you,
sipps
I have created a search page which looks at three recordsets, and checks their attributes against what the user has input in a text box.
One of the searches checks against a customers first and last name, so if I typed in 'Joe' ot 'Bloggs' then it would find the customer 'Joe Bloggs', but I can't figure out how to search for he customer Joe Bloggs when both his first and last name are input into the text box.
My search query is simple:
SELECT Customer_ID, Customer_Fname, Customer_Lname, Customer_Postcode, Customer_Email
FROM customer
WHERE Customer_Fname LIKE '$HTTP_POST_VARS[searchtext]' OR Customer_Lname LIKE '$HTTP_POST_VARS[searchtext]' OR Customer_Email LIKE '$HTTP_POST_VARS[searchtext]' OR Customer_Postcode LIKE '$HTTP_POST_VARS[searchtext]'
Is there something I can do to get it to send back a result if it is in the Customer_Fname or Customer_Lname?
Also, when I use the % sign in the query, it shows all teh records when the user first gets to the search page, when no search criteria has been entered, is there anyway of stopping this from happening apart from jumping to a new page to show the results?
Thank you,
sipps