RE: Search problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi,
> 
> I need to build up a search module for a shop. If I make a 
> basic search (product title for example) it is ok.
> 
> $query = "SELECT product_id FROM products WHERE title LIKE 
> '%$title%'";
> 
> But i need an advance search for more than one field (title, 
> description, price, weight)
> The problem is that i don't know which field is filled in by 
> the user (title, description, price or weight)
> I mean, the user can fill in all fields, or only price field, 
> or title and weight etc
> 
> How can i do the search? 
> 
> Thanks
 
$query = "SELECT product_id FROM products WHERE title LIKE 
'%$title%' and description LIKE '%$description%' and price like '%$price%'
and weight like '%weight%'";


JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux