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);

?>

原文地址:https://www.cnblogs.com/lsz3034/p/3991976.html