PHP Sort Order????
I will buy whoever solves this one a well deserved beer because it is driving me crazy trying to puzzle it out.
Anyway, I have a site created with CubeCart V3 (I know there are better alternatives but I'm stuck with it this time.) While adding a product the categories are displayed in a html option drop down box and the appropriate one is chosen from the list...
The trouble is the categories are displayed in some random order and there are now over 100 categories. You can imagine it is a real chore trying to sort through and find the right one every time a new product is added.
I have found the block of code that queries the database and displays the option drop down but I don't know how to get it to sort in ascending alphabetical order.
Here is the code block:
<?php for ($i=0; $i<count($categoryArray); $i++){ ?> <option value="<?php echo $categoryArray[$i]['cat_id']; ?>" <?php if(isset($results[0]['cat_id']) && $categoryArray[$i]['cat_id']==$results[0]['cat_id']) { echo "selected='selected'"; } ?>> <?php echo getCatDir($categoryArray[$i]['cat_name'],$categoryArray[$i]['cat_father_id'], $categoryArray[$i]['cat_id']); ?> </option> <?php } ?>
T
Thanks & Regards,
Reach us at dukeduke600@gmail.com.
Web Design| Logo Design | Banner Design | Web Development | Mobile Applications [iPhone/iPad/Android/Windows Phone]
"Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."