Hello,
I have this script which creates 'next' and 'previous' links so you can cycle through images. It works fine, but if there is only one image, I would like the 'next' link to not show up.
How can I do this please?
The code currently is:
Many thanks
James
I have this script which creates 'next' and 'previous' links so you can cycle through images. It works fine, but if there is only one image, I would like the 'next' link to not show up.
How can I do this please?
The code currently is:
Code:
$SQL="SELECT * FROM images where pubid='$jio' order by imageid";
$SQL_Query=mysql_db_query($DB_Name, $SQL);
$Total=mysql_num_rows($SQL_Query);
// Append a LIMIT clause to the SQL statement
if (!$Result_Set)
{
$Result_Set=0;
$SQL.=" LIMIT $Result_Set, $Per_Page";
}else
{
$SQL.=" LIMIT $Result_Set, $Per_Page";
}
// Run The Query With a Limit to get result
$SQL_Query=mysql_db_query($DB_Name, $SQL);
$SQL_Rows=mysql_num_rows($SQL_Query);
// Display Results using a for loop
for ($a=0; $a < $SQL_Rows; $a++)
{
$SQL_Array=mysql_fetch_array($SQL_Query);
$Description=$SQL_Array['image_name'];
echo "<img src=\"pubimages/$Description\"><BR><BR>";
}
// Create Next / Prev Links and $Result_Set Value
if ($Total>0)
{
if ($Result_Set<$Total && $Result_Set>0)
{
$Res1=$Result_Set-$Per_Page;
echo "<A class=\"blue\" HREF=\"vacancies4.php?Result_Set=$Res1&jio=$jio&pubname=$pubname&street=$street&town=$town&county=$county&pcode=$pcode&description=$description\">Previous Image</A> ";
}
if ($Result_Set>=0 && $Result_Set<$Total)
{
$Res1=$Result_Set+$Per_Page;
if ($Res1<$Total)
{
echo " <A class=\"blue\" HREF=\"vacancies4.php?Result_Set=$Res1&jio=$jio&pubname=$pubname&street=$street&town=$town&county=$county&pcode=$pcode&description=$description\">Next Image</A>";
}
if ($Res1==$Total)
{
$Res1=0;
echo " <A class=\"blue\" HREF=\"vacancies4.php?Result_Set=$Res1&jio=$jio&pubname=$pubname&street=$street&town=$town&county=$county&pcode=$pcode&description=$description\">Next Image</A>";
}
}
}
Many thanks
James