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
https://forums.phpfreaks.com/topic/235707-to-join-or-not-to-join/
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.