我想创建一个脚本,让您通过图像导航(下一个和上一个)。这是我到目前为止所做的,但它不起作用。
表:images
行:imageID
行:image_name
=>这是建立一个查看图像的链接。
$currentid = $row['imageID'];
$query = "SELECT imageID as prev
FROM images WHERE imageID < '$currentid'
ORDER by imageID DESC LIMIT 1;";
$result = mysql_query($query) or die("Unable to read table : $query");
$list = array();
while ($image = mysql_fetch_assoc($result)) {
$list[] = $image["imageID"];
}
$current_item = array_search($id1,$list);
$prev_link = $next_link = "";
if ($current_item > 0) {
// do previous link with $list[$current_item - 1]
}
if ($current_item < sizeof($list)-1) {
// do next link with $list[$current_item + 1]
}