Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.