Hi,
I am trying to write a script that will load data from a row, display it, and at the bottom of the page have links to the data from the previous row and the next row.
ie: Let's say the page displays lyrics from a db.
The query string will fetch the result for say song #75
$result = mysql_query("SELECT * FROM songs WHERE song=$song",$db); \ in this example $song=75
$myrow = mysql_fetch_array($result);
print("<p> <br />");
printf("<span class=\"highlight\">Album: %s</span>\n<br />", $myrow["album"]);
printf("<span class=\"song\">Song: %s</span>\n<br />", $myrow["songname"]);
printf("<span class=\"songcredits\">Author: %s</span>\n<br />", $myrow["author"]);
printf("</p> %s\n", $myrow["lyrics"]);
Now after the lyrics are displayed, I would like to put two links at the bottom of the page as follows.
<a href="?song=74">Name of song #74</a> | <a href="?song=76">Name of song #76</a>
How do I do this? and such that if there is no song #74 or song #76 it won't give me a bad link?
Thanks in advance!