| Current Path : /var/www/html/rkala/data/ |
| Current File : /var/www/html/rkala/data/checker.php |
<?php
$mysqli = new mysqli("172.16.21.83", "root2", "cobolt@112358", "proto_type");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$city = "bim2016001";
/* create a prepared statement */
if ($stmt = $mysqli->prepare("Select name from student where id = ?")) {
/* 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();
?>