Jump to content

Results wont display when try ordering them


Go to solution Solved by FUNKAM35,

Recommended Posts

if(empty($_GET['order_by']))$order="order by rate3 ASC ";
if($_GET['order_by']=='rate3asc')$order="order by rate3 ASC ";
if($_GET['order_by']=='rate3desc')$order="order by rate3 DESC ";
if($_GET['order_by']=='bedsasc')$order="order by beds ASC ";
if($_GET['order_by']=='bedsdesc')$order="order by beds DESC ";

$select = "SELECT prop_id, agent_id, ref, price, prop_type, town, province, country, location, beds, baths, pool, url, description, image1, rate1, rate2, rate3, currency, ski_area, sleeps, holiday_parks, shortdescription FROM rental WHERE $where LIMIT $from, $max_results ".$order;
echo  "<table width=\"40%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"left\">
<tr><td class=\"norm\" align=\"left\">
<div class=\"styled-select\">
<form id=\"formorder\" action=\"$_SERVER[PHP_SELF]\" method=\"get\">
<select name=\"order_by\" onChange=\"UpdateQty(this)\" >
<option value=\"sort by\" selected=\"selected\">Sort by</option>
<option value=\"rate3asc\">Lowest Price First</option>
<option value=\"rate3desc\">Highest Price First</option>
<option value=\"bedsasc\">Beds (Low to High)</option>
<option value=\"bedsdesc\">Beds (High to Low)</option>
<input type=\"submit\" name=\"submit\" id=\"button\" value=\"go\"> 
</form></div></td><td class=\"norm\" align=\"left\">\n";
if($order_by=="rate3 asc"){
echo"Sorted by Lowest Price First";
}
if($order_by=="rate3 desc"){
echo"Sorted by Highest Price First";
}
if($order_by=="beds asc"){
echo"Sorted by Least Bedrooms First";
}
if($order_by=="beds desc"){
echo"Sorted by Most Bedrooms First";
}
echo"</tr></td></table>\n";
$pic_count=0;
echo  "<table width=\"70%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"position:absolute; margin-top:40px; margin-left:180px; height=100%;\">\n";
if($num_rows = mysql_num_rows($results)==0)
{
echo  "There are no Holiday Homes for Rental in $country Please Visit Again Soon as This Website is Updated Daily";
}
while ($query_data = mysql_fetch_row($results))
{
$prop_id=$query_data[0];

Hi, I am trying to order my results with two parts of code and the results will not display, the same code works on a different website so I don't think its that far off?

 

Many thanks

You have defined the query ($select) but you have not executed it. You need to call mysql_query to run a sql query on a mysql database (provided you have connected to MySQL and selected a database first)

Edited by Ch0cu3r
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.