Control Flow Functions - MySql
Posted: Fri Feb 10, 2006 9:56 pm
Okay, I should start by saying...I DIDN'T DESIGN THIS...
I'm working with a table such as:
With that said, each status field has a corresponding PHP var...
Now the easy way would be to create a table of user status' and do a join...I don't have that luxury...
When I output the data I do this:
$row['status'] being the recordset...
This is all fine and dandy except I need to sort by status Alpha and not numeric. The real example is much more complex so I can't just do a PHP array sort
I can give another example if need be
I'm working with a table such as:
Code: Select all
ID | Name | Status
1 | Joe | 5
2 | Dave | 2
3 | James | 1Code: Select all
$a_status = array( 1 => 'Active', 2 => 'Suspended', 3 => 'Not Valid' );When I output the data I do this:
Code: Select all
echo $a_status[$row['status']];This is all fine and dandy except I need to sort by status Alpha and not numeric. The real example is much more complex so I can't just do a PHP array sort
I can give another example if need be