php - create a dropdown of unique options -


there 2 sqlite tables in db, units.id,unitname , departments.unit,department... units.id , departments.unit same.

the following list unitname each department, in example 10 of same unitname. looking slick way list unique unitnames. pardon ignorance because know easy..

<?php  foreach ($departments $dept) {    foreach ($units $unit)    {       if ($dept['unit'] == $unit['id'])       {           $options[$dept['id']] = $unit['unitname'];;       }    } } echo form_dropdown('unit',$options,'0'); ?> 

some lovely detail;

$seenbeforearray[]; $size = sizeof($dept); ($i=0; $i < $size ; $i++) {     if (in_array($dept[$i]['unitname'],$seenbeforearray[])){         unset($dept[$i]);     } else {         array_push($seenbeforearray, $dept[$i]['unitname']);     } } 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -