cats/functions/cleanDatabase.php

13 lines
820 B
PHP
Raw Permalink Normal View History

2013-01-19 18:38:58 +00:00
<?php
function cleanDatabase(){ // Alle Fragen die keine Antworten besitzen werden gel<65>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());
}
?>