I need to convert numerical values from a field [clarity_grade] within a mySQL table to a text value, the data is imported to the mySQL server from a script provided by one of my suppliers, the data comes from them in numerical format.
The script they provided comes with this example of how to convert the data:
function return_clarity($input){
$clarity_grade_array = array(
0 => "IF",
1 => "VVS1",
2 => "VVS2",
3 => "VS1",
4 => "VS2",
5 => "SI1",
6 => "SI2",
7 => "I1",
8 => "I2",
9 => "I3");
return $clarity_grade_array[$input];
}
Unfortunately the programmer they had who wrote the script is gone, so I can't ask him for advice / help.
I've tried replacing $input with $clarity_grade because I believe the $input reference is intended for use with a form based query and I want to display the data in a table.
When I bring the data in from the mySQL table, it still displays as a number. I've tried calling it as &clarity($clarity) and return_clarity($clarity) to no avail.
Somebody please put me out of my misery