A little disturbing query !!!

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

 



Hello, 
I have a query that I'm unable to work it out, each time I run it I get
some error, I need your help. 

I have a webtemplates table which contains some basic information about
each template (author, price, description, ...etc). I created a search
form that a user can use to search by type(by description, author,
..etc) he chooses the type he want (radio button) then types his
searchterm,  and the following query works very fine:

$query = "SELECT * FROM templates where ".$_POST[searchtype]." LIKE
'%".$_POST[searchterm]."%'";

But now I need the search to be more advanced, the user may enter a
price range to find results within a range of two numbers, I have added
to the form two textfields the first for the low price ($lprice) the
second for the high price ($hprice).. the 'price' field is located in
the same table (templates).

Now I want to  add to the query to make it does the following:

- if the user doesn't type any price range, the above query will be
executed.

- if he typed a price range, it'll be taken into consideration with the
within the cretirea he wanted.

for example, he may search for templates authored by John and their
prices are between 30 and 50.

I'm a php newbie, so I got error messages each time I try to extend my
simple query, I hope I can find some assistance here :)

Thank You, 

-- 
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