PHP Loops, MySQL database problem, help?

Haydn Bowley

New member
// Loop 4 times to create 4 drop down boxes

<?php $count = 1;

// Store the values from the database in an array
// Loop until it's reached the end of the database

$resultarray = array();
while($row_pinnt_subjects = mysql_fetch_assoc($pinnt_subjects)) {
$resultarray['subject']=$row;
}

// echo the html and the currently stored subject
do {
echo ("<p class='lite'>Subject" . $count . "</p>");
echo ("<select type='text' name='subject1' id='subject1'>");
echo ("<option selected='selected'>" . $row_pinnit_users['subject1'] . "</option>");

// Add value of +1 to $count
$count++;

// For every row in the $row_pinnit_subject database, echo the subject

foreach($resultarray as $row_pinnt_subjects) {
echo ("<option>" . $row_pinnt_subjects['subjects'] . "</option>");
}

echo ("</select>");

} while ($count <= 4);
?>

------------------------------------------------------------------------------------------------------------------------------
This is where I'm having the problem:
// Store the values from the database in an array
// Loop until it's reached the end of the database
and
// For every row in the $row_pinnit_subject database, echo the subject


I'm unsure what is wrong, there's definitely no syntax errors.
 
Back
Top