MySqli limit not binding to prepared statement -
i have made following prepared query. works if insert numbers manually ? are.
however, if bind parameters query not appear run. how can make can bind limit numbers?
if ($statement = $db -> prepare("select blog_id, account_id, title, creation_time, body, timestamp blogs order creation_time desc limit ?,?")) { $statement -> bind_param("ii", 2, 4); $statement -> execute(); $statement -> store_result(); }
when using bind_param()
, not give values directly, variables hold them. need is:
$offset = 2; $limit = 4; $statement->bind_param('ii', $offset, $limit);
Comments
Post a Comment