I am really not sure what kind of problem this is but my guss is that it has to do something with php here is the code:

echo "<tr>
    <td colspan=\"3\" align=\"center\">";
for ($I=0;$I<$nrow;$I++)
{
	$row1 = mysql_fetch_array($result);
	extract($row1);
	echo "<a href=\"./result?result_catalog=$TBL\"><img border=\"0\" src=\"http://www.eezs.com/images/$Picture\" width=\"111\" height=\"90\" /></a>";

  if ($I == 4)
  {
  	echo "</tr>
  	<tr>
    <td colspan=\"3\" align=\"center\">";
  }
  elseif ($I == 8)
  {
  	echo "</tr>
  	<tr>
    <td colspan=\"3\" align=\"center\">";
  }
  elseif ($I == 12)
  {
  	echo "</tr>
  	<tr>
    <td colspan=\"3\" align=\"center\">";
  }
  elseif ($I == 16)
  {
  	echo "</tr>
  	<tr>
    <td colspan=\"3\" align=\"center\">";
  }
  else
  {
  	echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  }
}
echo "</tr>";

The problem is that when ever it displays the picture with link the picture is one for all the diffrent pictures that were suppose to display and same goes with the link so is it something wrong with the php or what also there is something above this code too and it is :

$query = "SELECT * FROM `Catalog` WHERE `ED` = 'E'";
$result = mysql_query($query)
	or die("DB Error Please try again later");
$nrow = mysql_num_rows($result);
//to echo out links
echo "<tr align=\"center\" valign=\"top\">
    <td colspan=\"3\"><font color=\"#008000\" face=\"Arial\">Categories</font>";
      
for ($i=0;$i<$nrow;$i++)
{
	$row = mysql_fetch_array($result);
	extract($row);
	echo "<br />
        <a href='./result?result_catalog=$TBL'><font face=\"Arial\" size=\"2\" color=\"#969493\"><u>$Name</u></a>";
}
echo "</font><br /></td></tr>";

I am gussing there could be something wrong here too.w

the line

echo "<a href=\"./result?result_catalog=$TBL\"><img border=\"0\" src=\"http://www.eezs.com/images/$Picture\" width=\"111\" height=\"90\" /></a>";

displays and links the picture.

over here you need to make sure $TBL and $Picture that are used are changed everytime. otherwise it will just display the same link/picture each time.


inside the for loop, have something like:-

$TBL = $i;
$Picture = $i.".jpg";

modify the above statements to suit your needs.

Wouldn't the

extract($row1);

overwrite the variable every single time the loop repeats as this code works fine:

$query = "SELECT * FROM `Catalog` WHERE `ED` = 'E'"; 
$result = mysql_query($query) 
    or die("DB Error Please try again later"); 
$nrow = mysql_num_rows($result); 
//to echo out links 
echo "<tr align=\"center\" valign=\"top\"> 
    <td colspan=\"3\"><font color=\"#008000\" face=\"Arial\">Categories</font>"; 
       
for ($i=0;$i<$nrow;$i++) 
{ 
    $row = mysql_fetch_array($result); 
    extract($row); 
    echo "<br /> 
        <a href='./result?result_catalog=$TBL'><font face=\"Arial\" size=\"2\" color=\"#969493\"><u>$Name</u></a>"; 
} 
echo "</font><br /></td></tr>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.