$data = $mysqli->prepare("SELECT amount FROM items WHERE id=:id");
echo 'forward1';
if(!$data->execute(array(':id' => $id)))
die("error executing".$data->error);
echo '2';
$row = $data->fetch_object();
die('Losing my mind'.$row->amount);
这只会回显“forward1”,而不是“error execution ...”或“2”。它适用于 *$mysqli->query"。如果我在查询中为 :id 添加引号 '',它将回显“forward1error execution”。