0
到目前爲止,我已經使用準備好的語句從數據庫中獲取一行。但是,我如何在頁面上寫入多行。在網上看,人們似乎只顯示如何獲得一排。MySQL準備好聲明,寫入多行
if ($count_sets->num_rows > 0) {
$query = "SELECT id,jpg,udate,imageset FROM images WHERE dodelete = ? AND udate = ? AND imageset = ?";
if ($stmt = $mysqli->prepare($query)) {
//echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
$stmt->bind_param("isi",$deleted,$session_date,$imageset);
$stmt->execute();
$stmt->store_result();
//Get result
$stmt->bind_result($result_id,$result_jpg,$result_date,$result_imageset);
//Number of rows returned
$count_rows = $stmt->num_rows;
}
} else {
echo "No images to process, do an upload first!";
}
$folder = str_replace("/", "", $session_date);
if ($count_rows > 0) {
echo "hel<br />";
echo $result_jpg[0];
}
你的問題是什麼?你不能做多行? – hichris123
我不知道如何將結果打印到頁面上。試過一個foreach循環,但那不起作用... –