Saturday, January 2, 2010

Easy Sort Function

I was wondering what would be the easiest way to sort (thru pagination) "tickets" based on a value in the ticket.
 
My tickets have a value in the table of 0,1,2, or 3 based on priority
 
So on the index page need 4 links then if clicked will pull all tickets based on the priority value.
 
Url would look like tickets/high or tickets/low or something similar.
 
I could easily make 4 functions so the function would pull records based on conditions value => 1 but that seems like overkill to have 4 same functions.
 
If i could make a function sort($priority)
{
 
//pull records based on priority
 
}
 
But not sure how i would get the value other than doing an
if ($priority ==="high")
{
$priority_value = 3;
 
}
 
Ideas?
 
Thanks
 
Dave

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate