Jump to content

To join or not to join


Xtremer360

Recommended Posts

I'm trying to figure out the best way to do this if I'm doing it right with my for loop. With how many numAnswers there are for the selected poll its going to put the div with the label and text box for each of those but its giong to go and tie in each of those pollAnswers with what ID of the pollAnswer to the pollAnswer table.

 

 

$pollsQuery = "
    SELECT 
        polls.question, 
        polls.statusID,
        polls.numAnswers,
        DATE_FORMAT(polls.dateExpires, '%m/%d/%Y') AS dateExpires
    FROM 
        polls
    WHERE 
        polls.ID = '" . $pollID . "'";
$pollsResult = mysqli_query ( $dbc, $pollsQuery ); // Run The Query 
$row = mysqli_fetch_array ( $pollsResult, MYSQL_ASSOC );

$pollAnswers = "
    SELECT
        pollAnswers.ID,
        pollAnswers.answer
    FROM
        pollAnswers
    WHERE
        pollAnswers.pollID = '" . $pollID . "'"; 
$pollAnswersResult = mysqli_query ( $dbc, $pollAnswers ); // Run The Query 

 

<fieldset class="answerLeg">
        <legend>Edit Poll Answers</legend>
        <?php for ( $j = 0; $j <= $numAnswers; $j++) { ?>
            <div class="field required answers">
                <label for="answer<?php $j?>">Answer <?php $j?></label><input type="text" class="text" name="answer<?php $j?>" id="answer<?php $j?>" title="Answer <?php $j?>"/>
                <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span>      
            </div>
        <?php } ?>
    </fieldset>

 

 

 

 

Link to comment
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.