华山轮贱

php 数据库select函数//待编辑

<?php

   $con = mysql_connect("localhost","root","root");

     if (!$con)

        {

        die('Could not connect: ' . mysql_error());

        }

 

  mysql_select_db("sa", $con);

  $result = mysql_query("SELECT * FROM doc");

  echo"<table>";

   while($row = mysql_fetch_array($result))

   {

    echo"<tr>";

       $num=count($row);

 

       for ($x=0; $x<$num; $x++)

       {

        echo "<td>";

         echo $row[$x];

         echo "</td>";

       }

    echo"</tr>";

   }

  echo"</table>";

   mysql_close($con);

?>

 

posted on 2014-09-25 06:33  华山轮贱  阅读(287)  评论(0编辑  收藏  举报

导航