Example #1
0
$qIDs = check_var('q_id', 'POST', true, false, true);
if ($qIDs[0] == ',') {
    $qIDs = substr($qIDs, 1);
}
$tmp_q_ids = explode(',', $_POST['q_id']);
$result = $mysqli->prepare("SELECT DISTINCT paper_title, paper, paper_type FROM (papers, properties) WHERE papers.paper = properties.property_id AND properties.deleted IS NULL AND question IN ({$qIDs})");
$result->execute();
$result->store_result();
$result->bind_result($paper_title, $paper, $paper_type);
$found = $result->num_rows;
$result->close();
if ($found == 0) {
    // Only delete if the question is on zero papers.
    for ($i = 1; $i < count($tmp_q_ids); $i++) {
        $qID = $tmp_q_ids[$i];
        QuestionUtils::delete_question($qID, $mysqli);
    }
}
$mysqli->close();
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html;charset=<?php 
echo $configObject->get('cfg_page_charset');
?>
" />
  
  <title><?php 
echo $string['questiondeleted'];