Im trying to make a album with next/previous image. The first image(else statement) shows but the image url doesnt get switched when i press next/last.How can i solve this?
[code=php]
$next= $_POST[‘next’];
$last= $_POST[‘last’];
if($last== “last” ){
$result=mysqli_query($con, “SELECT * FROM album WHERE user_id=’$id’ AND (time_added>’$time’) LIMIT 1”);
$row=mysqli_fetch_array($result);
$time = $row[‘time_added’]; //Y-m-d H:i:s
$url = $row[‘img_url’];
}
else if($next== “next”){
$result=mysqli_query($con, “SELECT * FROM album WHERE user_id=’$id’ ORDER BY time_added DESC AND (time_added<‘$time’) LIMIT 1”);
$row=mysqli_fetch_array($result);
$time = $row[‘time_added’];
$url = $row[‘img_url’];
}
else{
$result=mysqli_query($con, “SELECT * FROM album WHERE user_id=’$id’ ORDER BY time_added DESC LIMIT 1”);
$row=mysqli_fetch_array($result);
$url = $row[‘img_url’];
$time = $row[‘time_added’];
}