mysqlデータベースに接続してクエリーする



  
  
  
  
  1. php mysql
  2.  
  3. <?php 
  4. $con = mysql_connect("localhost","root","root"); 
  5. mysql_select_db("mysql"); 
  6. $query="select * from user where  User='root'"
  7. $result=mysql_query($query); 
  8. while ($row=mysql_fetch_object($result)){ 
  9.    echo $row->Password;   
  10.   } 
  11.  
  12. if($row=mysql_fetch_array($result)){ 
  13.     echo  ."$row[User]"
  14.   mysql_fetch_object():    -> 
  15.   mysql_fetch_array()  ,  
  16.   mysql_fetch_row()  
  17.   mysql_fetch_assoc()  。  
  18.  
  19.       mysql_fetch_array()    mysql_fetch_object()