I have a php mysql query and on the results, I end up with an array which I explode into a drop-down list. The list is of ID numbers. The ID numbers relate to another table. What I need to do is replace the ID numbers with the name... ie. ID 1 becomes apple and ID 2 becomes orange.
My tables (the parts that matter):
My dealers.dealers_type stores ~ separated values of department.department_id. I need to change the department.department_id to department.department_name
Here is what I have which is working, just need to replace the id with the name from the department table:
$str = $dealers_type;
$str2 = substr($str, 0, -1);
$data = explode("~",$str2);
foreach($data as $k => $v)