This is the Code:
<?php
$db=mysqli_connect('localhost', 'root', '', 'db');
$sql = 'SELECT `Questions`, `OptionA`, `OptionB`, `OptionC`, `OptionD` FROM `ccoai questions` ORDER BY RAND() LIMIT 2';
$result = $db->query($sql);
echo '<table width="100%">
';
// Print each file
for($i=0;$i<$limit;$i++)
{
echo "<ol><li>";
while($row = $result->fetch_assoc()) {
// $nice_date = date('d-m-Y', strtotime( $row['doregistration'] ));
echo "
<tr>
<td>{$row['Questions']}</td></tr>
<tr><td><input type='radio' value='{$row['OptionA']}'>{$row['OptionA']}</td></tr>
<tr><td><input type='radio' value='{$row['OptionB']}'>{$row['OptionB']}</td></tr>
<tr><td><input type='radio' value='{$row['OptionC']}'>{$row['OptionC']}</td></tr>
<tr><td><input type='radio' value='{$row['OptionD']}'>{$row['OptionD']}</td></tr>
</tr>";
}
// Close table
echo '</li></ol></table>';
}
}
// Free the result
$result->free();
}
else
{
echo 'Error! SQL query failed:';
echo "<pre>{$db->error}</pre>";
}
// Close the mysql connection
$db->close();
?>
- ";
– e-logiX Youtube Oct 09 '18 at 12:55– e-logiX Youtube Oct 09 '18 at 12:55
- {$row['Questions']}
I tried this and this also doesnt work – e-logiX Youtube Oct 09 '18 at 13:06