Created
October 17, 2011 20:19
-
-
Save paddya/1293676 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DB-Kram einbinden | |
$tunings = $db->get_results("SELECT * FROM tunings"); | |
$by_component = array(); | |
foreach($tunings AS $tuning) { | |
$by_component[$tuning['component']] = $tuning; | |
} | |
$delete = array(); | |
foreach($by_component AS $component AS $ctunings) { | |
$keep = array(); | |
foreach($ctunings AS $tuning) { | |
if(!isset($keep[$tuning['name']])) { | |
$keep[$tuning['name']] = true; // wir checken eh nur den Key, also reicht hier irgendwas !== null | |
} else { | |
$delete[] = $tuning['id']; | |
} | |
} | |
} | |
var_dump($delete); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment