我已经读了很多遍了-只是想澄清一下(我想我很困惑)
我今天切换到 mysqli,并开始使用准备好的语句。
我准备好的陈述的例子
function read($table, $var) {
if($stmt = mysqli_prepare($link, "SELECT * FROM ? WHERE `uid`=?")) {
mysqli_stmt_bind_param($stmt, "si", $table, $var);
mysqli_stmt_execute($stmt);
return mysqli_fetch_assoc($stmt);
} else {
echo '<script type="text/javascript>">alert("Something went wrong");</script>';
}
}
$info = read("users", $_SESSION['uid']);
$char = read("characters", $_SESSION['uid']);