How do you use prepared statements without having any parameters to bind, f.ex. an SELECT query for retrieving all columns and rows within an table?
As i understand, prepared statements are good for security and efficiency, but isnt it possible to use it ONLY for either security or efficiency?
I have tried to look up answers on this, but without any luck.
Code (outputs nothing)
$stmt = mysqli_stmt_init($link);
$sql = "SELECT * FROM `table`";
mysqli_stmt_prepare($stmt, $sql);
mysqli_stmt_execute($stmt);
$res = mysqli_stmt_get_result($stmt);
while($row = mysqli_fetch_array($res)){
foreach($row as $val){
printf($val\n);
}
}