Skip to content

Commit

Permalink
Include post update of DB with existing data. Update item subcategori…
Browse files Browse the repository at this point in the history
…es to improve and simplify search
  • Loading branch information
jrie committed Feb 22, 2019
1 parent f280702 commit 7942d41
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions updateDB.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
include_once('head.php');

$items = DB::query('SELECT id, label, subcategories FROM items');

if ($items != null) {
foreach($items as $item) {
$subIds = trim($item['subcategories'], ',');
$newSubIds = ',' . $subIds . ',';
DB::update('items', array('subcategories' => $newSubIds), 'id=%d', $item['id']);
printf('%s - updated...<br/>', $item['label']);
}
}

echo '<br/><br/>Items update done.';
die();

0 comments on commit 7942d41

Please sign in to comment.