Hey all,
Does anyone know of a way to natsort() something like this, either in mysql or php? A lot of the items in $name below are numbers and need to sort naturally.
$sqlCAT = "select id, name from ".$tableCollab["tctest"]." where sub_category_id='" . $myrowCOM[0] . "' order by name";
$resultCAT = mysql_query($sqlCAT, $conn);
while ($myrowCAT = mysql_fetch_row($resultCAT)) //loop through all
{
$tc_number = stripTree($myrowCAT[0]);
$name = stripTree($myrowCAT[1]);
echo "['<font color=gray>".$name."</font>','../test/viewtest.php?restriction=NoHeader']\n\n,";
}
since $name is outputing one line at a time just looping thru all the names, I can't get natsort to work as there is nothing to sort but one at a time. Any ideas either doing this via the sql call, or some way to put natsort in so the names are like 1. name 2.name 3. name instead of 1.name 2.name 20.name 3.name 30.name etc.