mysqlデータベースに接続してクエリーする
2345 ワード
- php mysql
-
- <?php
- $con = mysql_connect("localhost","root","root");
- mysql_select_db("mysql");
- $query="select * from user where User='root'";
- $result=mysql_query($query);
- while ($row=mysql_fetch_object($result)){
- echo $row->Password;
- }
-
- if($row=mysql_fetch_array($result)){
- echo ."$row[User]";
- }
- mysql_fetch_object(): ->
- mysql_fetch_array() ,
- mysql_fetch_row()
- mysql_fetch_assoc() 。
-
- mysql_fetch_array() mysql_fetch_object()