Hi I have a relational database as such
tenant_details
| id | surname | firstname | etc...................
tenant_data
| id | tenant_detailsid | county | etc...............
I display the results using
include("dbinfo.inc.php");
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM tenant_data WHERE county='$county' ORDER by date DESC";
$result=mysql_query($query);
$num=mysql_num_rows($result);
if ($num==0) {
$empty = "No Matching";
}
else {
$num_rows = mysql_num_rows($result);
}
$bg_color1 = '#EEEEEE';
$bg_color2 = '#FFFFFFF';
$i = 0;
while ($row = mysql_fetch_array($result)) {
$bg_color = (($i%2 == 0 || $i == 0) ? $bg_color1 : $bg_color2);
$tenant_detailsid = $row["tenant_detailsid"];
// further rows etc
?>
<form>
<td><input type="hidden" size="150" value="<? echo $tenant_detailsid; ?>" name="id"><? echo "<td bgcolor=$bg_color align='center'><input type='submit' value='$tenant_detailsid'></td>"; ?></form>
<?
$i++;
}
echo "</table>";
?>
This gets the results from the database as required.
I have been trying to use a second query using the tenant_detailsid to get the surname and firstname from the table tenant_details. I then want to display the details within the submit button as such
<input type='submit' value='$first $last'>.
I have tried a second query and have been looking through the forum for the last two days trying different code etc with little joy. any help is much appreciated,
thanks in advance roscor