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++;
120
36
Other php-forum
Are sessions secure at all?..
I haven't really gotten into yet, but I was just thinking of something weird..
Lets say you h
help with database debug pls
Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/chec
Reading Most Recent CSV File in Directory
I thought I had wrapped this project up, but found out that the program I use to FTP a csv file to m
Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt i
Strange Oracle Query problem
Ok So I have this PHP class that talks to a Javascript class that basically creates a table of infor
help me fix these syntax errors...
I keep getting multiple syntax errors on this script like this one:
Parse error: syntax error
need to add "sizes" to shopping cart
Hey guys, I am trying to figure out a way to add a "size" selector on to this bit of code.
"GROUP BY" in arrays
Well i'm looking to do something i usually could do easily using COUNT and GROUP BY if it was a sql
php/mysql problem
Hey all,
Problem: im trying to setup a shop where people can use a drop-down list to select t
I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES