forked from science-ation/science-ation
29 lines
712 B
PHP
29 lines
712 B
PHP
<?
|
|
function db_update_117_post()
|
|
{
|
|
global $config, $pdo;
|
|
|
|
$qmap = array('years_school' => 'Years School',
|
|
'years_regional' => 'Years Regional',
|
|
'years_national' => 'Years National',
|
|
'willing_chair' => 'Willing Chair');
|
|
|
|
foreach ($qmap as $field => $head) {
|
|
$q = $pdo->prepare("SELECT id FROM questions WHERE db_heading=?");
|
|
$q->execute([$head]);
|
|
while ($i = $q->fetch(PDO::FETCH_OBJ)) {
|
|
$id = $i->id;
|
|
|
|
/* Drop all answers for this question */
|
|
$stmt = $pdo->prepare("DELETE FROM question_answers
|
|
WHERE questions_id=?");
|
|
$stmt->execute([$id]);
|
|
}
|
|
|
|
/* Now dump the question itself */
|
|
$stmt = $pdo->prepare("DELETE FROM questions
|
|
WHERE id=?");
|
|
$stmt->execute([$id]);
|
|
}
|
|
}
|