mardi 30 décembre 2014

Unable to get a Drop down to propagate more than once in a table


Vote count:

0




Building a table with several Drop downs. For one I want to have a drop down with all the names from the query. I almost have it but it only propagates for the first row, all other rows are are empty for for the name drop down.


Try as I might I am unable to see where the break down is. Can someone let me know where I am going wrong?



$query="select index_member, name from members where active=1 order by name";
$rs=$db->query($query);
if($rs === false) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $db->error, E_USER_ERROR);
}else {
$rows_returned = $rs->num_rows;
}
echo $rows_returned;

echo "<table>";
echo "<tr>";
echo "<th>Rank</th><th>Name</th><th>Town Hall</th><th>Experience</th>";
echo "</tr>";
for ($count=1 ;$count<=$rows_returned;$count++){
echo "<tr><td>";
echo $count;
echo "</td>";
// !!!!!!!! the names iterate only for first row instead of each row!!!!!!!
echo "<td>";
echo "<select name='Name'>";
while($row = mysqli_fetch_array($rs)) {
echo '<option value="'.$row['name'].'">'.$row['name']."</option>";
}
echo "</select>";
echo "</td>";


echo "<td>";
echo "<select name='TH'>";
for ($th=3;$th<=10;$th++){
echo '<option value="'.$th.'">'.$th."</option>";
}
echo "</select>";
echo "</td>";
echo "<td>";
echo "<input type='number' name='EXP'>";
echo "</td>";

echo "</tr>";
}
echo "</table>";


asked 2 mins ago







Unable to get a Drop down to propagate more than once in a table

Aucun commentaire:

Enregistrer un commentaire