PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $conn = &$mysqli; $sql = mysqli_query($conn, "SELECT * FROM `questions_tab` ORDER BY RAND() LIMIT 1"); $q = mysqli_fetch_array($sql); echo '<b>Question &nbsp;'.$q['id'].'&nbsp;::<br /><br />'.$q['question'].'</b><br /><br />'; $qry = mysqli_query($conn, "SELECT * FROM `options_tab` WHERE question_id = " . $q['id']); while ($o = mysqli_fetch_array($qry)) { echo'<input type="radio" name="ans" value="'.$o['id'].'">&nbsp;'.$o['opt'].'<br /><br />'; } echo'<br><button type="submit">&nbsp;Submit</button></form>';
Show:  
Copy Clear