Hi Pete.
This is a follow on from an earlier thread. I have posted a new one because the original problem has bee solved thanks to many of your guys.
The issue at the moment is I have a script which displays records in a table of cols and rows.
the output is:
Table containing row and cols, yes great so far.
Col 1 contains the record ID.
Col 2 contains the country name.
Col 3 contains a pic of the coutry flag.
But the problem now is
first row: ID = 1, country= Argentina, flag = Argentina
second row: ID = 2, country= Australia, flag = Argentina and Australia
Third row: ID = 3, country = Austria, flag = Argentina, Australia and Austria.
This continues dow the table. Each row has the corect flag plus every other counties flag.
Any ideas as to why or how it is picking up the other flags.
SCRIPT
<?php
include 'error.inc';
include 'fb.inc';
$connection = mysql_connect($server, $user, $password);
mysql_select_db($database, $connection);
$offset=$_GET['offset'];
$step = $diff = 9;
$r = mysql_query("SELECT COUNT(*) FROM flags") or die(mysql_error());
$anz = mysql_result($r,0);
if ($offset+$diff>=$anz) {
$diff = $anz - $offset;
$vor = TRUE;
}
if (!$offset || $offset<0) {
$offset = 0;
$zur = TRUE;
}
$query = "select id, flag from flags order by flag LIMIT $offset,$diff";
$result = mysql_query($query) or die(mysql_error());
// Start a table, with column headers
echo "\n<table bgcolor=\"#EDF3F2\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing\"0\" bgproperties=\"fixed\">" .
"\n\t<td width=\"10%\" bgcolor=\"#99000\"><font color=\"white\" size=\"2\" ></td>" .
"\n\t<td width=\"30%\" bgcolor=\"#990000\"><font color=\"white\" size=\"2\" >id</td>" .
"\n\t<td width=\"60%\" bgcolor=\"#990000\"><font color=\"white\" size=\"2\" face=\"arial\">Flag</td>" .
"\n</tr>";
echo "\n<tr>\n\t<td></td>\n</tr>";
echo "\n<tr>\n\t<td></td>\n</tr>";
echo "\n<tr>\n\t<td></td>\n</tr>";
// Until there are no rows in the result set,
// fetch a row into the $row array and ...
while($row = mysql_fetch_array($result))
{
$body .="<img src = \"flags/$row[flag].gif\">";
// ... start a TABLE row ...
echo "<tr bgcolor=\"#EDF3F2\" onMouseOver=\"this.style.backgroundColor ='#FFFF99'\" onMouseOut=\"this.style.backgroundColor ='#EDF3F2'\">";
echo "<td align=\"left\"><font color=\"black\" face=\"arial\"size=\"1\" >" .$row["id"] ."\n\t";
?>
<td align="left" width="766"><font color="black\" face="arial\"size="1"> <a href=\"embassies/emb.php?idname=<? echo urlencode($row["flag"]).">".$row["flag"] ?></a></td>
<? "\n\t";
echo "<td align=\"left\"><font color=\"black\" face=\"arial\"size=\"1\" >" .$body ."\n\t";
echo "</tr>";
// Finish the row
echo "\n</tr>";
}
if($zur!=TRUE)echo'<a href="'.$PHP_SELF.'?id='.($id-($tmp+$step)).'&offset='.($offset-$step) . ' "><font face=arial size=-6>Back </a> ';
for ($i=1;$i<=(int)ceil($anz/$step);$i++) echo '<font face=arial size=-6><a href="'.$PHP_SELF.'?id='.(($i-1)$step).'&offset='.(($i-1)$step). '" > '.$i.'</a> ';
if ($vor != TRUE) echo '<a href="'.$PHP_SELF.'?id='.$id.'&offset='.($offset+$step).'"><font face=arial size=-6>Next</a>';
// Then, finish the table
echo "\n</table>\n";
// Close the connection
if (!(mysql_close($connection)))
showerror();
?>
Regards