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


// 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 Like 36 Dislike
Previous forums Next forums
Other forums

A little help needed passing hidden values to next page
I have a page that has hidden values in a form.

example
Code: <input name='signupID

how to configure ADS in ABAP instance
Hi All,

I am working on r/3 4.7 ABAP system.Can we configure ADS(adobe document services)

what business processes?
Hi,

A general question. What business processes (like OTC - Order to Cach, P2P, R2R etc)

convert pps to wsf with php'how?
hi
i want to convert with php
PowerPoint file to swf file(flash)
how please?
thank!!!

how do I show what a user have selected from a checkbox?
From my code below, how would i show which check boxes have been checked and which radio buttons sel

Recognising Revenue daily
Hello.
Has anyone come across daily recognition of deferred income?
We want to implement R

PHP and SMS
Hi all forum members. I am new here and am unsure what category shoild I post this in.
Moderator

The control with ID 'ace' requires a ScriptManager on the page
I'm trying to add a simple AlwaysVisibleControlExtender to my page, but it's not working. I get the

Calling All PHPFREAKS Blackberry Users
Are you a member of PHPFreaks and have a blackberry? Well RIM just recently released Blackberry Mes

read integers that returns a negative or prints the average
Im trying to finish this homework assignment by tommarow afternoon and I keep getting stuck.
Wr

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash