I need 3 question from 6. but every time randomize show fast 4 question.
/*for random question*/
public function qustionShow($question){
$query = $this->conn->query("select * from question where cat_id='$question'");
$c = mysqli_num_rows($query);
$rand = rand(3, $c)-3;
$show = $this->conn->query("select * from question where cat_id ='$question' and id >'$rand' LIMIT 4");
while ($row=$show->fetch_array(MYSQLI_ASSOC)){
$this->qus[]=$row;
}
return $this->qus;
}
Aucun commentaire:
Enregistrer un commentaire