I've read many times over - and just want to clarify (I think I'm confused)
I switched to mysqli today, and started using prepared statements.
Example of my prepared statement
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']);
Do i still need to escape anything? I know, i know, i've read it everywhere that you dont need to escape when using prepared statements, but then there are questions like this and this that make me worried.