prepare($sql); $prep_statement->execute(); $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); //find the missing default settings $x = 0; foreach ($array as $setting) { $found = false; $missing[$x] = $setting; foreach ($default_settings as $row) { if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) { $found = true; //remove items from the array that were found unset($missing[$x]); } } $x++; } //add the missing default settings if (count($missing) > 0) foreach ($missing as $row) { //add the default settings $orm = new orm; $orm->name('default_settings'); $orm->save($row); $message = $orm->message; unset($orm); //print_r($message); } unset($missing); //unset the array variable unset($array); } ?>