Need help with PHP/MySQL drop down menu
Posted on
16th Feb 2014 07:03 pm by
admin
I need help on how I can implement a drop down menu which queries mysql database and output the available data based on price range. This feature has been used here http://www.vebra.com - I will appreciate your help.
$searchSQL = "SELECT * FROM simple_search WHERE";
Did you know?Explore Trending and Topic pages for more stories like this.
// grab the search types.
$types = array();
$types[] = isset($_GET['price'])?"`price` LIKE '%{$searchTermDB}%'":'';
$types[] = isset($_GET['location'])?"`location` LIKE '%{$searchTermDB}%'":'';
$types = array_filter($types, "removeEmpty"); // removes any item that was empty (not checked)
if (count($types) < 1)
$types[] = "`id` LIKE '%{$searchTermDB}%'"; // use the estate as a default search if none are checked
$andOr = isset($_GET['matchall'])?'AND':'OR';
$searchSQL .= implode(" {$andOr} ", $types) . " ORDER BY `price`"; // order by price.
$searchResult = mysql_query($searchSQL) or die("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}");
if (mysql_num_rows($searchResult) < 1) {
$error[] = "The search term provided <i>{$searchTerms}</i> yielded no results.";
}else {
$results = array(); // the result array
$i = 1;
while ($row = mysql_fetch_assoc($searchResult)) {
$results[] = "{$row['location']} <br/>{$row['image']}<br/>{$row['price']}";
$i++;
No comments posted yet
Your Answer:
Login to answer
120
36
Other forums
PHP Display Telephone Number On Referrer
I have used the php below to show a different telephone number in the header of the site depending u
Forms Authentication and Refresh at Login page
Hello,
When I try to press the Login button in my webapplication at my login.aspx page nothing h
Php script to read msword file
hi,
I need to read a msword file and i want to print the contents in that word file.
i
Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to
Members Only
Hi all, for my website i have a members area only which on members can veiw, but at the moment anyon
Expandable Post Code
Hi,
Hope you can help. Which currently I haven't upgraded to connect to a mysql server, so i
The IE or FF detector
Hello Friends,
Problem of today ( we seek for php help ) as following ,
we know all th
check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.
The method delivers er_changed_data.
Target costs on Process orders not calculating
Hi All,
We have released standard costs for all the materials. We have also done Goods r
How to get the previous months last date....
Here's my wittle problem. I suck at working with dates.
So today is 10/20/2009, i need to fig