You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cats/functions/cleanDatabase.php

13 lines
820 B
PHP

<?php
function cleanDatabase(){ // Alle Fragen die keine Antworten besitzen werden gelöscht
$sql_1="delete from statistics where q_id in (SELECT q_id from questions where active = ".abs(intval(0))." and not exists (select 1 from answers where questions.q_id=answers.q_id))";
$query_1 = mysql_query($sql_1) OR die(mysql_error());
$sql_2="delete from answers_incorrect where q_id in (SELECT q_id from questions where active =".abs(intval(0))." and not exists (select 1 from answers where questions.q_id=answers.q_id))";
$query_2 = mysql_query($sql_2) OR die(mysql_error());
$sql_3="delete from questions where active = ".abs(intval(0))." and not exists (select 1 from answers where questions.q_id=answers.q_id)";
$query_3 = mysql_query($sql_3) OR die(mysql_error());
}
?>