1.2.1556. ext/mysqli¶
Extension mysqli for MySQL.
The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.
<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world');
/* check connection */
if (mysqli_connect_errno()) {
printf('Connect failed: %s\n', mysqli_connect_error());
exit();
}
$city = 'Amersfoort';
/* create a prepared statement */
if ($stmt = $mysqli->prepare('SELECT District FROM City WHERE Name=?')) {
/* bind parameters for markers */
$stmt->bind_param('s', $city);
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($district);
/* fetch value */
$stmt->fetch();
printf('%s is in district %s\n', $city, $district);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
See also MySQL Improved Extension, MySQL and Mariadb.
1.2.1556.1. Specs¶
Short name |
Extensions/Extmysqli |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |