1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php $db = new PDO( 'mysql:dbname=' . $cfg['DB']['database'] . ';host=' . $cfg['DB']['host'], $cfg['DB']['username'], $cfg['DB']['password'] ); $categories = []; $stmt = $db->query('SELECT uid, title, parent FROM sys_category WHERE deleted = 0'); foreach ($stmt as $row) { if (isset($categories[$row['title']])) { die("Double title\n"); } $categories[$row['title']] = $row['uid']; } |