日期:2014-05-17 浏览次数:20394 次
include ('../db/MySqlConnect.php');
$conn = new MySqlConnect();
$mysqli = $conn->getConnection();
$sql = 'select id, username, password from admin where id = ?';
$seach_id = 1;
settype($seach_id, "integer");
if($stmt = $mysqli->prepare($sql)) {
$stmt->bind_param('i', $seach_id);
$stmt->execute();
$stmt->bind_result($rs_id, $rs_name, $rs_password);
if($stmt->fetch() == NULL) {
echo 'no result';
} else {
printf('id:%s, name:%s, password:%s <br/>', $rs_id, $rs_name, $rs_password);
}
$stmt->close();
$mysqli->close();
}