html中select语句读取mysql表中内容_PHP技巧

时间:2010-01-09 08:29:30   来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:strsql);  $data=@mysql_fetch_array($result);  $record=@mysql_num_rows($result);  echo "<select name=type size=1>/n";       do{             if ($record==1){       ...
  正文:

<?
  $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";
                          }
             else{
                echo "<option value=".$data['cname'].">".$data'cname']."</option>/n";
             }
       }while($data=@mysql_fetch_array($result));
       echo "</select>/n";
?>


来源:http://www.002pc.com/master/College/Programming/PHP/11668.html

收藏到:

关于《html中select语句读取mysql表中内容_PHP技巧》文章的评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

随机文章

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by rand() limit 10

顶出来的热门

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by diggtop desc,id desc limit 10
站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td