close
<?php
//假定數據庫用戶名:root,密碼:123456,數據庫:RUNOOB
$con = mysqli_connect ( "localhost" , "root" , "123456" , "RUNOOB" );
if ( mysqli_connect_errno ( $con ))
{
echo "連接MySQL失敗: " . mysqli_connect_error ();
}
$sql = "SELECT name,url FROM websites ORDER BY alexa" ;
$result = mysqli_query ( $con , $sql );
//獲取數據
mysqli_fetch_all ( $result , MYSQLI_ASSOC );
//釋放結果集
mysqli_free_result ( $result );
mysqli_close ( $con );
?>
全站熱搜
留言列表