Support Forums


Go Back   68 Classifieds Forums > Help & Support > Modules / Plugins / Modifications

Notices

 
LinkBack Thread Tools Display Modes
Old 01-09-2009, 10:00 PM   #11
Member
 
Join Date: Dec 2008
Posts: 34
Rep Power: 3
cflo is on a distinguished road
Default

Here is what I found:

function getStates()
{
global $db;
$sSQL="SELECT name FROM ".PREFIX."states ORDER BY name ASC";
$result=$db->query($sSQL);
while($rs=$result->fetch()){
$states[]=$rs;
}
$result->freeResult();
return $states;
}

Modified:

$sSQL="SELECT name FROM ".PREFIX."ORDER BY abbrev, name ASC";

Is this correct?
Thanks!

Quote:
Originally Posted by Mike-N-Tosh View Post
I guess actually the proper syntax would be "ORDER BY abbrev, name ASC"

I think that should do it.

-Mike
__________________
Developer v4.0.9
cflo is offline   Reply With Quote
Old 01-09-2009, 10:04 PM   #12
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,618
Rep Power: 47
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

That's exactly what you're looking for. Just add the abbrev to the ORDER by like this:

$sSQL="SELECT name FROM ".PREFIX."states ORDER BY abbrev, name ASC";

Always keep a back up! Always comment your modifications, so you know what you did later on!

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 01-09-2009, 10:15 PM   #13
Member
 
Join Date: Dec 2008
Posts: 34
Rep Power: 3
cflo is on a distinguished road
Default

I just added Hawaii and it came up 3rd on the list. The code did not change anything. Am I doing something wrong?


Quote:
Originally Posted by Mike-N-Tosh View Post
That's exactly what you're looking for. Just add the abbrev to the ORDER by like this:

$sSQL="SELECT name FROM ".PREFIX."states ORDER BY abbrev, name ASC";

Always keep a back up! Always comment your modifications, so you know what you did later on!

-Mike
__________________
Developer v4.0.9
cflo is offline   Reply With Quote
Old 01-09-2009, 10:19 PM   #14
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,618
Rep Power: 47
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

The suggested modification was based on the assumption of what you stated earlier in that you entered "CAN" and "USA" in the abbrev fields for the states. It should work as it is sorting by the abbreviation first then by the name.

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 01-09-2009, 10:28 PM   #15
Member
 
Join Date: Dec 2008
Posts: 34
Rep Power: 3
cflo is on a distinguished road
Default

I added the states abbrev USA and CAN but I does not seem to work.
It still picks up the state name before the abbreviation.


Quote:
Originally Posted by Mike-N-Tosh View Post
The suggested modification was based on the assumption of what you stated earlier in that you entered "CAN" and "USA" in the abbrev fields for the states. It should work as it is sorting by the abbreviation first then by the name.

-Mike
__________________
Developer v4.0.9
cflo is offline   Reply With Quote
Old 01-09-2009, 10:34 PM   #16
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,618
Rep Power: 47
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Hmmm, the only thing I can think is that you may need to also select the abbrev in order to ORDER BY it.

Try this:
$sSQL="SELECT name, abbrev FROM ".PREFIX."states ORDER BY abbrev, name ASC";

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 01-09-2009, 10:38 PM   #17
Member
 
Join Date: Dec 2008
Posts: 34
Rep Power: 3
cflo is on a distinguished road
Default

I tried that now, but no luck. Same thing.
Should this reflect in my "/administration/settingsstates.php" admin view?

Quote:
Originally Posted by Mike-N-Tosh View Post
Hmmm, the only thing I can think is that you may need to also select the abbrev in order to ORDER BY it.

Try this:
$sSQL="SELECT name, abbrev FROM ".PREFIX."states ORDER BY abbrev, name ASC";

-Mike
__________________
Developer v4.0.9

Last edited by cflo; 01-09-2009 at 10:46 PM.
cflo is offline   Reply With Quote
Old 01-09-2009, 10:49 PM   #18
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,618
Rep Power: 47
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

$sSQL="SELECT name FROM ".PREFIX."states ORDER BY abbrev ASC, name ASC";
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 01-09-2009, 10:54 PM   #19
Member
 
Join Date: Dec 2008
Posts: 34
Rep Power: 3
cflo is on a distinguished road
Default

That dont work either.

Quote:
Originally Posted by Mike-N-Tosh View Post
$sSQL="SELECT name FROM ".PREFIX."states ORDER BY abbrev ASC, name ASC";
__________________
Developer v4.0.9
cflo is offline   Reply With Quote
Old 01-09-2009, 10:56 PM   #20
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,618
Rep Power: 47
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Well, I don't understand that. Perhaps someone smarter than I can help out. Sorry.

-Mike
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.3)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I only have 1 country can a user select states? gstar Pre Sales Questions 5 09-11-2008 07:51 AM
Replace Country name by Country Code hel68c Modules / Plugins / Modifications 7 09-10-2008 08:56 PM
edit states and country ymac v4 Questions & Support 3 02-29-2008 04:04 PM
Select Provinces By Country. pschievink v3.1 Questions & Support 0 07-06-2007 02:02 PM
Multiple provinces pschievink v3.1 Questions & Support 3 06-22-2007 09:08 AM


All times are GMT -4. The time now is 09:55 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0