Help with ORDER BY


Posted on 16th Feb 2014 07:03 pm by admin

Hello. I would like to order by ascending States, then Cities, then Gyms in the following code, but I can't figure it out. If anyone could help, I would truly appreciated it!

if(isset($countryid))
{
Did you know?Explore Trending and Topic pages for more stories like this.
$sql = "Select * from ".TBGYM." G LEFT JOIN ".TBCITIES." CT ON G.cityid= CT.id LEFT JOIN ".TBSTATES." S ON CT.sid=S.id LEFT JOIN ".TBCOUNTRY." C ON S.cid=C.countries_id WHERE G.countryid=".$countryid;
}
if(isset($stateid))
{
$sql = "Select * from ".TBGYM." G LEFT JOIN ".TBCITIES." CT ON G.cityid= CT.id LEFT JOIN ".TBSTATES." S ON CT.sid=S.id LEFT JOIN ".TBCOUNTRY." C ON S.cid=C.countries_id WHERE G.stateid=".$stateid;
}
if(isset($cityid))
{
$sql = "Select * from ".TBGYM." G LEFT JOIN ".TBCITIES." CT ON G.cityid= CT.id LEFT JOIN ".TBSTATES." S ON CT.sid=S.id LEFT JOIN ".TBCOUNTRY." C ON S.cid=C.countries_id WHERE G.cityid=".$cityid;
}

$pager = new PS_Pagination($db, $sql, $noofrecords,$noofnavigators, "param1=valu1&param2=value2");

$pager->setDebug(true);

$rs = $pager->paginate();
if(!$rs) die(mysql_error());

while($row = mysql_fetch_assoc($rs)) {
$arr_result [] = $row;
}
No comments posted yet

Your Answer:

Login to answer
233 Like 17 Dislike
Previous forums Next forums
Other forums

convert static html data into dynamic
hi all

i need to convert a website which has static above 2000 articles into dynamic and add

RadioButtonList data selection
view plaincopy to clipboardprint?

Weird MySQL error, why am I recieving this?
PHP Code:


<?php require "global_settings.php"; ?>
<titl

send() and recv() parameters confusion
On server Side:
int recv (Socket,Buffer, Length, Flags)
On Client Side:
int send (Soc

a function to check directory depth
I'm working on a php script to upload files in to a set directory.
the user can select to upload

Transform value 0 in no and 1 in yes help needed
Hello,
I have this in the table: "value" type int 0 to represent false and 1 to represe

Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser

Extract text from string
Hi folks,

I have a string that looks like this:

aaaaaaaaaa:
bbbbbbbbbb (ccccccccc)

calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same

How to Create a Dynamic table
col1 col2 date1 date2 date3 date4..........
a b v1 v2 v3 v4

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