<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
  <head>
   <title> MySQL_Select.php </title>
   <meta charset="UTF-8">
   <meta name="Author" content="">
   <meta name="Keywords" content="">
   <meta name="Description" content="">
  </head>


  <body>
   <?php
   $conn=@mysql_connect("localhost","root","123") or die("连接错误");
   //mysql_select_db("test");
   mysql_select_db("test",$conn);


   $sql="select * from  `test`.`stuinfo`";
   //$ret=mysql_query($sql);
   $ret=mysql_query($sql,$conn);


   var_dump($ret);
   echo '<hr>';
    while($row=mysql_fetch_row($ret))
    {
  print_r($row);
  echo '<hr>';
    }
    print_r($row);
    echo '<hr>';
    $count=mysql_num_rows($ret);
    echo $count . '<br>';


   ?>


  </body>
 </html>
 
resource(4, mysql result)
 
Array ( [0] => 1 [1] => jim [2] => 10 ) 
Array ( [0] => 2 [1] => Tom [2] => 2 ) 
Array ( [0] => 3 [1] => Lucy [2] => 3 ) 
Array ( [0] => 4 [1] => Lily [2] => 4 ) 
Array ( [0] => 5 [1] => xiao3 [2] => 5 ) 
Array ( [0] => 6 [1] => xiao6 [2] => 6 ) 
Array ( [0] => 7 [1] => xiao7 [2] => 7 ) 
7