把你的list.php帖出来,看一下是不是代码问题。如果不是在想别的办法解决问题。

解决方案 »

  1.   

    <html>
    <?php
     $db=mysql_connect("localhost", "root","");
      mysql_select_db("kaoqin",$db);
      $query = "select * from tongji";
      $result = mysql_db_query($query,$db);
      if ($result) {
            echo "select results:(ul)";
            while ($r = mysql_fetch_array($result)) {
                    $riqi = $r["riqi"];
                    $yaobi = $r["yaobi"];
                    echo "<li> $riqi, $ysobi";
                  }
            echo "</ul>";
     } else {
            echo "no data in table.";
     }
     mysql_free_result($result);
    ?>
    <p> <a href = "add.php" >database adminstration </a>
    </html>
      

  2.   

    我运行这段代码没有问题,只显示no data in table.因为我的表里没有数据,这是正确的。改成这样试试:
    <?
     $hostname = "localhost";
     $username = "root";
     $password = "";
     $dbname = "kaoqi";
     $link = mysql_pconnect($hostname,$username,$password) or die(mysql_error());
      $db =mysql_select_db($dbname) or die(mysql_error());
      $query = "select * from tongji";
      $result = mysql_query($query);
      if ($result) {
            echo "select results:(ul)";
            while ($r = mysql_fetch_array($result)) {
                    $riqi = $r["riqi"];
                    $yaobi = $r["yaobi"];
                    echo "<li> $riqi, $ysobi";
                  }
            echo "</ul>";
     } else {
            echo "no data in table.";
     }
     mysql_free_result($result);
    ?>
    <p> <a href = "add.php" >database adminstration </a>
    </html>
      

  3.   

    php.ini中要加入--with-mysql=DIR 
    --with-mysql=/usr/local/mysql 
    --with-mysql=c:/mysql