嘿,我有一個快速的。有沒有辦法將變量包含到準備好的查詢中?例如:php mysqli準備好聲明
$sql = "SELECT id, title, author, LEFT(description, 40) AS excerpt,
image_small, image_med, date
FROM posts
ORDER BY id DESC
LIMIT $start, $postsPerPage";
$result = $connect->prepare($sql) or die ('error');
$result->execute();
$result->bind_result($id, $title, $author, $excerpt, $image_small, $image_med, $date);
謝謝!
你的問題是不完整的,我想你想問的是:我如何檢索準備好的查詢結果。你的結果變量將是空的,直到你調用'$ result-> fetch()' – knittl 2011-03-21 08:29:50