still learning and I trying to make buttons for Next and Prev.
So far I can pull the image from database and show in the page but buttons doesn't work. When I click on Next or Prev it's just reload the page with the same image.
Can someone help me with this?
Here is the code
Expand|Select|Wrap|Line Numbers
- if($q = mysqli_query($con, "SELECT * FROM images WHERE `name` = '". preg_replace('/[^.A-Za-z0-9]/ui', '', $_GET['name']) ."' LIMIT 1")) {
- if($row = mysqli_fetch_array($q)){
- echo '<a href="pic.php?name='.$row['name'].'" class="button button-blue"><span>Prev</span></a>';
- echo '<a href="pic.php?name='.$row['name'].'" class="button_next button-blue"><span>Next</span> </a>';
- echo "<img style=\"width:100%;margin:0 auto;\" src=\"upload/".$row['name']."\" />";
- } else {
- echo 'Not found';
- }
- } else {
- echo mysqli_error($con);
- }