你数据库中的表呢??应该是"select * from table";

解决方案 »

  1.   

    <?PHP
       //连接数据库
       @ $db = mysql_connect("localhost","root","");
          if(!$db)
          {
          echo"对不起,暂时没有活动项目.";
          exit;
          }
          //使用数据库
          mysql_select_db("hdxmb");
          //查询数据库
          $query = "select * from 表名";
          $result = mysql_query($query,$db);
          //取回查询结果
          $rows = mysql_fetch_array($result);
          echo $rows['字段名称'];
          ?>
      

  2.   

    $rows = mysql_fetch_array($result);
    echo $rows[字段名];建议使用我的mysql_result_all函数
    类似于ODBC函数库的odbc_result_all函数,调试mysql应用很有用的。
    mysql_result_all.inc
    <?php
    function mysql_result_all($result,$format="") {
      echo "<table $format><tr>";
      for($i=0;$i<mysql_num_fields($result);$i++) {
        echo "<th>".mysql_field_name($result,$i)."</th>";
      }
      echo "</tr>";
      while($row = mysql_fetch_row($result)) {
        echo "</tr>";
        for($i=0;$i<mysql_num_fields($result);$i++) {
          echo "<td>".$row[$i]."</td>";
        }
        echo "</tr>";
      }
      echo "</table>";
    }
    ?>
    你可以写作
    <?PHP
    include "mysql_result_all.inc";
       //连接数据库
       @ $db = mysql_connect("localhost","root","");
          if(!$db)
          {
          echo"对不起,暂时没有活动项目.";
          exit;
          }
          //使用数据库
          mysql_select_db("hdxmb");
          //查询数据库
          $query = "select * from 表名";
          $result = mysql_query($query,$db);
          //显示全部结果
          mysql_result_all($result);
          ?>