lucibalaj wrote:Hello, does anybody know how I can order based in values inside a field? I have a field called departments and I have the values inside it: secretary, vicepresident, president etc. I want to sort this in order to have as output president, vice-president, secretary etc. Thank you! Lucian.
I would create an enumeration so that you could rank them.
$department_names=array(1=>"President",2=>"Vice-President",3=>"Secretary);
so, in the db, the field would have a numeric value and your query could be ordered correctly (ORDER BY departments ASC), and in your html you can display the text version
echo $department_names[$row['departments']];