Jump to content

sorting by columns not working??


rhock_95

Recommended Posts

hope someone can help me... I have a table (see below) that ai am adding data to OUT side of chronological order...(i.e., categorically by alphabetical order...).... this puts the \"ID\" (auto increment) out of sync alphabetically...

 

My problem when I go back and reset the table order by \"category\"... it is not correct... there will be blocks of \"A\'s\" , \"B\'s\" , \"c\'s\", then more :A\'s\" etc... etc..

 

 

can anyone help me?

 

CREATE TABLE `bus_list` (

`name` varchar(255) NOT NULL default \'\',

`address` varchar(255) NOT NULL default \'\',

`city` varchar(255) NOT NULL default \'\',

`zip` varchar(15) default NULL,

`phone` varchar(40) default NULL,

`www` varchar(255) default NULL,

`notes` text,

`cat` varchar(255) default NULL,

`id` int(11) unsigned NOT NULL auto_increment,

`subcatid` varchar(11) default NULL,

PRIMARY KEY (`id`)

) TYPE=MyISAM AUTO_INCREMENT=1 ;

Link to comment
Share on other sites

by \"A\" I meant several categories that begin with the letter \"A\"...

 

the problem is... I have a script that has two drop down menus that are populated by the database... on is \"Citiy\" and the other is \"category\"

 

I really need the category menu to be in exact alphabetical order...?

 

any ideas?

 

 

//get data for city and category

$sql = \'SELECT DISTINCT city FROM bus_list\';

$r = mysql_query($sql) or die(mysql_error());

while($row = mysql_fetch_object($r))

{

$city[] = $row->city;

}

 

$sql = \'SELECT DISTINCT category FROM bus_list\';

$r = mysql_query($sql) or die(mysql_error());

while($row = mysql_fetch_object($r))

{

$category[] = $row->category;

}

Link to comment
Share on other sites

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.