On Apr 24, 2006, at 9:06 AM, Philip Thompson wrote:
On Apr 22, 2006, at 4:49 AM, William Stokes wrote:
Hello,
Any idea how to sort this?
I have a column in DB that contains this kind of data,
A20,B16,B17C14,C15,D13,D12 etc.
I would like to print this data to a page and sort it ascending by
the
letter an descending by the number. Can this be done? Like
A20
B17
B16
C15
C14
D13
D12
Thanks
-Will
Maybe I'm missing something, but I don't think that I've seen
anyone mention this. Can you not just sort the data before it
reaches your php code... meaning, via the db? My example uses MySQL:
<?
$result = msyql_query("SELECT * FROM your_database ORDER BY ASC",
$link);
Ooops!
... ORDER BY your_column ASC ...
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
$column[$i++] = $row["your_column"];
...
for ($i=0; $i<$numOfCols; $i++)
echo "$column[$i]<br/>";
?>
Again, I may have misread what you are asking, but this appears to
be a simple solution when pulling from a database.
Good luck,
~Philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php