我試圖爲我的網站創建user_login系統。現在我遇到了從數據庫中選擇user_info的問題,使用mysqli和準備好的語句。 我的問題是,我無法獲得任何輸出。但我在php.net上使用手冊。 以下是我已經得到了片刻:SELECT不會選擇
<?php
require_once 'php/includes/constants.php';
$connection = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME)or die("Error");
$phone = "0661488342";
$password = "1234";
$query = " SELECT *
FROM userinfo
WHERE phone = ? AND password = ?
LIMIT 1";
$stmt = $connection->prepare($query);
$stmt->bind_param('ss', $phone, $password);
$stmt->execute();
$res = $stmt->get_result();
$row = $res->fetch_assoc();
echo "Password = ".$row['password'];
錯誤:
Call to undefined method mysqli_stmt::get_result() in Z:...
你能告訴我一些關於這個?
版1 PHP版本5.2.12是(對不起,我忘了這) 但問題依然如故。我怎樣才能得到user_info?
什麼是您的PHP版本? 'mysqli_stmt :: get_result()'是在PHP 5.3中引入的。 –
爲什麼使用這樣一箇舊版本的PHP? 5.2在現代PHP功能中非常缺乏,而且不再支持它。 –
我的問題不是關於錯誤!這是關於獲取數據數組的正確方法! – Animus