RE: Result Shuffling problem in Mysql 04-12-2014, 11:19 AM
#5
@invisal I am not famailar with PDO hence I'm getting this error "Call to a member function prepare() on a non-object"
Here's my code:
I've edited your code according to my needs. I am totally mind boggled at the moment since I have a deadline till Monday and I want this to get solved today :S
P.S IF you want I can send you my whole script
Here's my code:
Code:
<?php
if (isset($_POST["answer"])) {
// check for correct answer, you need to query
// the question and answer again to compare
//global $prepare;
$sh = $db->prepare("SELECT * FROM mcqs WHERE question LIKE '%$sub%'");
$sh->bindValue("$sub", $_POST["question_id"]);
$question = $sh->fetch();
} else {
$sh = $db->prepare("SELECT * FROM mcqs ORDER BY RAND() LIMIT 1");
$question = $sh->fetch();
}
?>I've edited your code according to my needs. I am totally mind boggled at the moment since I have a deadline till Monday and I want this to get solved today :S
P.S IF you want I can send you my whole script




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)