Jump to content

[SOLVED] Database Array not Displaying


savagenoob

Recommended Posts

My script is not displaying the array like its supposed to. Doing a print_r shows all the data so I know the info is there, maybe someone can spot my error...

 

<?php
$select = "SELECT * FROM pq_crtp_quiz WHERE testname = '$testname' ORDER BY RAND() DESC LIMIT 1";
$query = mysql_query($select);
echo mysql_error();
echo $select;
$row[] = mysql_fetch_assoc($query);
print_r($row);

?>
<table>
    <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" name="questionans">
    <tr><td>Question #<?php echo $i;?></td></tr>
    <tr><td><?php echo $row['question'];?></td></tr>
    <tr><td>Option 1 <?php echo $row['option1']; ?><input name="option1" type="checkbox" value="option1" /></td></tr>
    <tr><td>Option 2 <?php echo $row['option2']; ?><input name="option2" type="checkbox" value="option2" /></td></tr>
    <tr><td>Option 3 <?php echo $row['option3']; ?><input name="option3" type="checkbox" value="option3" /></td></tr>
    <tr><td>Option 4 <?php echo $row['option4']; ?><input name="option4" type="checkbox" value="option4" /></td></tr>
    <tr><td><input type="submit" name="next" value="Next"></td></tr>
    </form>
    </table>

Link to comment
https://forums.phpfreaks.com/topic/151334-solved-database-array-not-displaying/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.