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¶m2=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
17
Other forums
How to generate a text file using php...?
Hi,
Can anyone give me code to generate a text file using php
Thanks in advance
FTP issues
Hi all,
I am currently facing some serious problems with a script and really need some ad
if description does not contain the following words
Hello everyone,
I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa
Problem with PHP/mySQL login code
Hello,
There is an error in my login script and I can't figure out what it is...
I believe
Form validation with functions
Hi there
I am trying to make a very simple form validation function. I currently have the fol
phpmailer class & pop.gmail.com?
Code: <?php
$mail->IsSMTP();
$mail->Host = "pop.gmail.com";
problem with GROUP BY and ORDER BY
i usually use this query to display the last 10 entries from a sql table:
Code: $query = &quo
Syntax error
hi im having a little trobble with this script
-------------------------------------------------
split values
I have values that are returned to me in this format:
name=>test,age=>49
pop3 and fsockopen
So I am able to connect to the pop3 server, log in, and check how many messages there are. I am hav