Jump to content

need help on query codes


pixeltrace

Recommended Posts

guys,

 

i need help

 

what codes do i need to use so that in my sql query

i can search items

WHERE lastname AND firstname LIKE '%". $_POST['name'] ."%'";

 

i have a form wherein you can search via the name of the person

either using the first name or last name.

but the query that i am using doesnt work and its giving me a (0) results

 

whats wrong in my query codes?

 

need help please

thanks!

Link to comment
https://forums.phpfreaks.com/topic/42203-need-help-on-query-codes/
Share on other sites

hi,

 

this one is working if i type either the last name or first name

 

but when i search typing both firstname and lastname on the search field

 

its giving me a (0) result

 

how do i fix this in such a way that if i also search using both firstname and last name

i can still get the correct result.

 

ex. if i search "juan pedro" or "juan" or "pedro"

 

they will still give me juan pedro in my result

 

thanks!

my mysql isnt the greatest of all things, but what about checking if both fields are entered. run the a query to check for both the first and lastname else then run a query to check either the first or the last. not even sure that makes much sense.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.