PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
hi
i use this code to search some inserts from mysql... but i would like to search the database taking into consideration all the words
this is a part from my code
//search variable = data in search box or url
if(isset($_GET['search']))
{
$search = $_GET['search'];
}
//trim whitespace from variable
$search = trim($search);
$search = preg_replace('/\s+/', ' ', $search);
//seperate multiple keywords into array space delimited
$keywords = explode(" ", $search);
//Clean empty arrays so they don't get every row as result
$keywords = array_diff($keywords, array(""));
I think that in this part of my code is the problem
can u help me plz to solve it...
tnx
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
What is the problem you are trying to solve? You haven't shown us any of the query code. If you do post more code, please enclose it in [syntax=php]...[/syntax] tags to make it easier for us to read.
i am using this code by shane.... when i am searching for e.g. Nick Brown it searches Nick or Brown. i want to seacrh Nick and Brown... Am i clear now? Sorry if i wasnt clear from the beginning
We will need to know a lot more in order to help you. What is the structure of the database table? Does it have one field in which you expect to find the string "Nick Brown" or does it have fields for first and last names? How are you obtaining the search string(s)? One form field? What is the SQL Query that you are using?