Hi all
I have 2 scripts, 1st script shows rows of data. The first feild has a URL attached to it, when a user clicks on the first feild it should look-up the record which is appended to the end of the URl. The append is held in $idname. If I echo the $idname it shows the correct record.
When the URL is executed it calls the second script which runs
OK with on errors but does not show any data.
FIRST SCRIPT
<?php
include 'error.inc';
include 'db.inc';
$connection = mysql_connect($server, $user, $password);
mysql_select_db($database, $connection);
$offset=$_GET['offset'];
$step = $diff = 10;
$r = mysql_query("SELECT COUNT(*) FROM embassies") 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 country, embassy_name from embassies order by country LIMIT $offset,$diff";
$result = mysql_query($query) or die(mysql_error());
// Start a table, with column headers
echo "\n<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing\"2\">" .
"\n\t<td width=\"20%\" bgcolor=\"#CCCCCC\"><font color=\"black\" size=\"2\" >Country</td>" .
"\n\t<td width=\"80%\" bgcolor=\"#CCCCCC\"><font color=\"black\" size=\"2\" face=\"arial\">Name</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))
{
// ... start a TABLE row ...
echo "\n<tr>";
?>
<td align="left" width="766"><font color="black\" face="arial\"size="2"> <a href=\"embassies/emb.php?idname=<? echo urlencode($row["country"]).">".$row["country"] ?></a>
</td>
<?
"\n\t";
echo "<td align=\"left\"><font color=\"black\" face=\"arial\"size=\"2\" >" .
$row["embassy_name"] .
"\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();
?>
SECOND SCRIPT
include 'error.inc';
include 'db.inc';
$connection = mysql_connect($server, $user, $password);
mysql_select_db("db66511019", $connection);
$result = mysql_query("SELECT * FROM embassies WHERE country = '$idname'" , $connection);
while ($row = mysql_fetch_array($result))
{
echo " <table width=100% border=0 cellspacing=0 cellpadding=0 background=../../Gif/Background.gif >";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "<tr>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td width=20% align=left><font face=arial size=2 color=red>Embassy Name</font></td>";
echo "<td><b>".$row["embassy_name"] . "</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left valign=top><font face=arial size=2 color=red>Address</td>";
echo "<td><font face=arial size=2 color=black>".$row["street"] ."</td>";
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red></font></td>";
echo "<td><font face=arial size=2 color=black>".$row["suburb"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red></font></td>";
echo "<td><font face=arial size=2 color=black>".$row["town"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red></font></td>";
echo "<td><font face=arial size=2 color=black>".$row["post_code"]."</td>";
echo "</tr>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red>Telephone No</font></td>";
echo "<td><font face=arial size=2 color=black>".$row["tele"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red>Fax No</font></td>";
echo "<td><font face=arial size=2 color=black>".$row["fax"]."</td>";
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red>E-mail</font></td>";
?>
<td align="left\"><font color="black\" face="arial\" size="-1"> <a href=mailto:<?= $row["email"] ?>>
<?= $row["email"] ?>
</a></td>
<?
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red></font></td>";
echo "<td></td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left><font face=arial size=2 color=red>Website</font></td>";
?>
<td align="left\"><font color="black\" face="arial\" size="-1"> <a href=http://<?= $row["web"] ?>>
<?= $row["web"] ?>
</a></td>
<?
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "</tr>";
echo "</table>";
}
?>
Can anyone see what is wrong with iether script.
Many thanks in advance
Dereck