データベースの項目テーブルで最新の行を選択して、タイトル、説明、別のフォルダーに保存されている項目の画像を表示しようとしていますが、パスは同じテーブルに保存されています。行を表示できますが、前のボタンが機能せず、最初の行に移動します。クリックするたびに1行前に移動したい。助けてください。以下は私のコードです
<?php
include("scripts/connection.php");
session_start();
if (empty($_SESSION["username"])){
header("Location:login.php");
}
$posts = "SELECT ID, Title, Description, PostDate, Image1, Image2, Image3 FROM items Order By PostDate";
$select = mysql_query($posts);
$numrows = mysql_num_rows($select);
if (isset($_POST['previous'])){
For($i=1,$i>=0,$i--){
mysql_data_seek ($select, $i);
$row=mysql_fetch_assoc($select);
$ID ="$row[ID]";
$title = "$row[Title]";
$datetime = "$row[PostDate]";
$image1 = "$row[Image1]";
$image2 = "$row[Image2]";
$image3 = "$row[Image3]";
$description = "$row[Description]";
}
}else{
while ($row = mysql_fetch_assoc($select)){
$ID ="$row[ID]";
$title = "$row[Title]";
$datetime = "$row[PostDate]";
$image1 = "$row[Image1]";
$image2 = "$row[Image2]";
$image3 = "$row[Image3]";
$description = "$row[Description]";
}
}
?>