程式風格中的 MySQLi 基本示例

<?php 
//Creating Connection to MySQL database using MySQLi
$mysqli = mysqli_connect("IP ADDRESS OR DOAMIN", "username", "password", "database_name");

//Executing Query in the Database using MySQLi
$result = mysqli_query($mysqli, "SELECT * FROM TABLE");

//Getting Results from MySQL 
$row = mysqli_fetch_assoc($result);
echo $row[columnName];

//Closing connection to the Database
$mysqli_close($mysqli);

?>