Hi all,
I wonder if anyone could help me with the code below which is driving me crazy!
The code works ok, as it is at the moment, but is it not formating the page in a way I would like it to look.
Basically, I would like the first page to be as a table, with each field as a sperate cell, and for the hyperlink to be assigned only to the "propertyid" field. As you can see, at the moment it groups all the fields together and makes it one big hyperlink.
To see this in action, you can go you www.homesinspain.ltd.uk/testlisting.php
I would like it to look like this: www.homesinspain.ltd.uk/testlisting_table.php (but with the hyperlink assigned to the first column - this is what I can't work out)
Any ideas would be gratfully received.
The php code is:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Show Listing</title>
</head>
<?php
$db = mysql_connect("homesinspain.ltd.uk", "*****", "*****");
mysql_select_db("Listingdb",$db);
// Display individual record
if ($id) {
$result = mysql_query("SELECT * FROM tblproperty WHERE propertyid=$id",$db);
$myrow = mysql_fetch_array($result);
printf("HIS Ref: %s\n<br>", $myrow["hisref"]);
printf("Area: %s\n<br>", $myrow["area"]);
printf("Location: %s\n<br>", $myrow["location"]);
printf("Type: %s\n<br>", $myrow["type"]);
printf("Bedrooms: %s\n<br>", $myrow["bedrooms"]);
printf("Price: %s\n<br>", $myrow["price"]);
} else {
//show property list
$result = mysql_query("SELECT * FROM tblproperty",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<a href=\"%s?id=%s\">%s %s %s %s %s %s</a><br>\n",
$PHP_SELF, $myrow["propertyid"], $myrow["hisref"], $myrow["area"], $myrow["location"], $myrow["type"], $myrow["bedrooms"], $myrow["price"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
</body>
</html>