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
36
Other forums
max function question
Hi All
Ihave a table that holds shipment numbers and dates like this
select * from
gettext translates ALWAYS?
I'm using gettext with the new version of XAMPP (5.3.0) on Windows Seven RTM (build 7600)
gettext
How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.
I am working on a application wh
JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w
need good snippet manager
Hi. as i am coding and learning more, it is becoming difficult to manage code snippets. how you mana
InternetOpenUrl() Invalid cert
Hi all,
Does anyone know how to prevent calls to InternetOpenUrl() from failing with erro
PEAR Email Attachment w/ $gpg
I have no issues with this code if I take out the attachement section and include the info in the em
Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r
Dealing with code in db query
I am dealing with C code and I need to make sure it is encoded some how to ensure its integrity and
How can I uploading Transactional Data from Legacy to New SAP system
Hell Gurus,
I am overwhelmed with questions on how to migrate huge volume of Sales Orders