Sometimes it will, and then it won't
Posted: Sun Sep 11, 2005 9:29 am
I'm trying to create a button that will bring you back to a certain page, i.e.: You where on a page that shows you thumbnails of some pics from a person, who's pic urls are held in a database, you click on a thumbnail and it show you the full thing, but it will only put a button going back sometimes.
The Code is:
I know I have the If at the end, but that is when (as you can see) the link goes wrong and gives a link show.php?find= , it should show show.php?find=$Username, $Username being the page of the persons thumbnails
The Code is:
Code: Select all
<?php
echo "<center><table cellpadding='5' border='1'>";
echo "<tr>";
if (isset($_GET["pic"]))
{
echo "<td valign='center'>
<img src='".$_GET['pic']."' border='0'></td>";
$connection = mysql_connect($host,$user,$password) #13
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection) #15
or die ("Couldn't select database");
$thing = mysql_escape_string($_GET['pic']);
$query = "SELECT person,pic FROM pics WHERE pic = '".$thing."'";
$result = mysql_query($query)
or die ("Couldn't execute query.");
$row = mysql_fetch_row($result);
if ($_GET["pic"] == $row[1])
{
echo "<div align='center'>
<table border='1' bgcolor='#999999'><td><a href='show.php?find=".$row[0]."'>
<font color='white' face='Verdana, Arial, Helvetica, sans-serif' size='2'>
Back to ".$row[0]." Section</font></a></td></table></div>";
}
}
else
{
echo "No pics found";
}
echo "</tr><center></table>"; #55
?>