html中select语句读取mysql表中内容_PHP技巧 |
|
来源:互联网 作者:网络转载 发布时间:2007-12-29 |
|
|
以下为引用的内容: <? $record=0; $db=@mysql_pconnect('localhost','root'); @mysql_select_db('1234',$db); $strsql="select * from 1234_data"; $result=@mysql_query($strsql); $data=@mysql_fetch_array($result); $record=@mysql_num_rows($result);
echo "<select name=type size=1>\n"; do{ if ($record==1){ echo "<option value=".$data['cname']." selected>".$data['cname']."</option>\n"; phperz~com } else{ echo "<option value=".$data['cname'].">".$data'cname']."</option>\n"; } }while($data=@mysql_fetch_array($result)); echo "</select>\n"; ?> |
phperz~com
|
|
[收藏此页] [打印本页] [返回顶部] |
|
|
|
|
|
|
|
|
|