<code><?php mysql_connect('localhost','root',''); mysql_select_db('test'); mysql_query('set name uft8'); $sql='select * from tset'; $result=mysql_query($sql); ?> <?php <?php while($row=mysql_fetch_array($result)): 菜单:<select> <option value="1"><?php $row['username']?></option> <option value="2">选项二</option> <option value="3">选项三</option> <?php endwhile?> ?> </code>
这样好像不行 该咋循环捏
<code><?php mysql_connect('localhost','root',''); mysql_select_db('test'); mysql_query('set name uft8'); $sql='select * from tset'; $result=mysql_query($sql); ?> <?php <?php while($row=mysql_fetch_array($result)): 菜单:<select> <option value="1"><?php $row['username']?></option> <option value="2">选项二</option> <option value="3">选项三</option> <?php endwhile?> ?> </code>
这样好像不行 该咋循环捏
<?php
标签不能嵌套吧
多了一个<?php
<?php $row['username']?>
修改成 <?php echo $row['username']?>
<code><?php mysql_connect('localhost','root',''); mysql_select_db('test'); mysql_query('set name uft8'); $sql='select * from tset'; $result=mysql_query($sql); ?> 菜单:<select> <?php while($row=mysql_fetch_array($result)):?> <option value="<?=$row['id']?>">=$row['username']?></option> <?php endwhile?> </select> </code>