我正在嘗試爲我的數據庫創建一個「下一個按鈕」,因此我可以一次查看一個圖像。然而,我現在的方式只改變了網址,而不是實際上的圖像check it out here.無論網址是什麼,它都會堅持圖像上最高的ID(87)。我該如何解決?php sql查詢更改url,但不會更改數據
這是我的分貝的樣子
<?php
require("includes/conn.php");
if (isset($_GET["imagecount"]))
$next = (int)$_GET["imagecount"]; //int is for sql injection
else
$next = 0;
$result = mysql_query("select * from people order by id desc limit $next, 1") or die(mysql_error());
?>
<?php
$result = mysql_query("select * from people order by id desc limit 0, 1 ") or die ("haznot DB: " . mysql_error());
while ($row = mysql_fetch_assoc($result))
{
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" /><br />";
}
?>
<a href="images.php?imagecount=<?php echo $next+1; ?>">Next</a>
所以我必須做的而不是這個? – ramr
http://pastebin.com/EWMKUbkf –