I am writing a script to display images on my site. The images are stored on the server and the source (path) is on a mySQL database. I want to be able to move to the next (or previous picture) by invoking two php functions I have made to do so. The code I have written so far is:
<?php require "db_connection.php"; $query="SELECT source FROM photos"; $result=mysql_query($query); $count=0; $numberofpics=mysql_num_rows($result); $image=mysql_result($result, $count, "source"); $num=1; function slideshowForward() { $num=$num+1; if($num==($numberofpics+1)) { $num=1; } $count=$count+1; $image=mysql_result($result, $count, "source"); } function slideshowBack() { $num=$num-1; if ($num==0) { $num=$numberofpics; } $count=$count-1; $image=mysql_result($result, $count, "source"); } ?>The html portion to display the images is: