我正在尝试从 mysql 填充下拉列表值并将其显示在 html 表的 td 中,我尝试使用下面的代码,但它没有从 mysql 填充值可以帮助我如何做到这一点。
<table id="CPH_GridView1" style="width:1452px">
<thead>
<tr>
<th style=" width:102px">Clien ID </th>
<th style=" width:100px">Country</th>
<th style=" width:248px">Network Name </th>
<th style="text-align:center; width:102px" >cppn </th>
</tr>
</thead>
<tbody>
<?php
$sql = mysql_query("SELECT * FROM clientpricenotifications");
while($rows=mysql_fetch_array($sql))
{
if($alt == 1)
{
echo '<tr class="alt">';
$alt = 0;
}
else
{
echo '<tr>';
$alt = 1;
}
echo '<td id="CPH_GridView1_clientid" style="width:140px" class="edit clientid '.$rows["id"].'">'.$rows["clientid"].'</td>
<td id="CPH_GridView1_country" style="width:160px" class="edit country '.$rows['id'].'">'.$rows["country"].'</td>
<td id="CPH_GridView1_networkname" style="width:156px" class="edit networkname '.$rows["id"].'">'.$rows["networkname"].'</td>';
?>
<td>
<select name=' . customer_name . '>
<?php
$query = 'SELECT cppn FROM clientpricenotifications';
$result = mysql_query($query, $db) or die(mysql_error($db));
while ($row = mysql_fetch_assoc($result))
{
echo '<option value="' . $row['id'] . '"> ' . $row['cppn'] . '</option>';
}
?>
</select>
</td>
</tr>'
}
?>