set_charset("utf8"); $numbers = range(0, 495); $isSearch = $_POST['isSearch']; if(!$isSearch) { shuffle($numbers); $NOQ = $_POST['NOQ']; $where = " type='0'"; if($_POST['mk']){ $where .= "OR type='mk'"; } if($_POST['md']){ $where .= "OR type='md'"; } if($_POST['me']){ $where .= "OR type='me'"; } if($_POST['mf']){ $where .= "OR type='mf'"; } if($_POST['mr']){ $where .= "OR type='mr'"; } if($_POST['h']){ $where .= "OR type='h'"; } if($_POST['es']){ $where .= "OR type='es'"; } if($_POST['ee']){ $where .= "OR type='ee'"; } if($_POST['ev']){ $where .= "OR type='ev'"; } if($_POST['m']){ $where .= "OR type='m'"; } if($_POST['o']){ $where .= "OR type='o'"; } if($_POST['ah']){ $where .= "OR type='ah'"; } if($_POST['am']){ $where .= "OR type='am'"; } if($_POST['cs']){ $where .= "OR type='cs'"; } if($_POST['v']){ $where .= "OR type='v'"; } } else { if(strlen($_POST['source']) > 9) return; $where = " source LIKE '".$_POST['source']."'"; $NOQ = 495; } $done=0; for ($i=0; $i <= 495; $i++) { $sql = "SELECT ID, source, descr, ans1, ans2, ans3, ans4, correct, type, pic FROM fizika WHERE ID=$numbers[$i] AND (". $where.")"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { echo '
'; echo '

'.($done+1).'.

'.$row['source'].'

'; echo '
'.$row['descr'].'
'; if($row['pic']){ if($row['ID'] > 435){ echo '
'; } else { echo '
'; } } echo '



'; if($row['ans4']){ echo '
'; } echo '
'; echo ''; echo '
'; $done++; } if($done == $NOQ){ break; } } if($done == 0){ echo '
Nem található a keresésnek megfelelő feladat!
'; } echo ''; $conn->close(); ?>