Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.