Here are the closest :

");*/ $sock = msqlConnect(); if ($sock < 0) { fatal("Error : $ERRMSG\n"); } if (msqlSelectDB($sock,"take-away") < 0) { fatal("Error : $ERRMSG\n"); } /*********************************************************************************************************************/ if (msqlQuery($sock,"select record_no, cuisine, business_name, stno_name, city_suburb, state, postcode, phone_no from take_away_restaurants where cuisine='$cuisine' and postcode='$postcode'") <0) { fatal("Error : $ERRMSG"); } $res = msqlStoreResult(); $num_rows = msqlNumRows($res); $row = msqlFetchRow($res); while (#$row > 0) { $business_name = sub($row[2],"\"",""); $file_name = "/usr/local/apache2.2/htdocs/take-away/adverts/" + $row[0] + ".txt"; $sbuf = stat("$file_name"); if (#$sbuf > 0) { echo("

"); echo("$row[2]
"); $their_postcode = $row[6]; $their_address = $row[3] + "," + $row[4] + "," + $row[5] + "," + $their_postcode; echo("
$row[3] $row[4]
$row[5] $row[6]
$row[7]
"); echo("map
"); $fd = open("$file_name", "<"); if ($fd < 0) { echo("File not found: $record_no.txt $ERRMSG\n"); } else { echo("
"); close($fd); } echo("
"); } else { echo("$row[2]"); $their_postcode = $row[6]; $their_postcode = urlEncode($their_postcode); $their_address = $row[3] + "%20" + $row[4] + "%20" + $row[5] + "%20" + $their_postcode; echo("
$row[3] $row[4]
$row[5] $row[6]

$row[7]


"); echo("map

"); } $counter++; $row = msqlFetchRow($res); } msqlFreeResult($res); /*********************************************************************************************************************/ if (msqlQuery($sock,"select distinct to_city_suburb, to_state from distance where from_postcode='$postcode' and distance_klms < 12") <0) { fatal("Error : $ERRMSG\n"); } $res = msqlStoreResult(); $row = msqlFetchRow($res); if ($num_rows < 1) { echo("

1st Error. $num_rows $postcode

"); } else { while (#$row > 0) { $to_city_suburb = $row[0]; $to_state = $row[1]; if (msqlQuery($sock,"select record_no, cuisine, business_name, stno_name, city_suburb, state, postcode, phone_no from take_away_restaurants where cuisine='$cuisine' and city_suburb CLIKE '$to_city_suburb' and state CLIKE '$to_state'") <0) { fatal("Error : $ERRMSG"); } $res2 = msqlStoreResult(); $num_rows2 = msqlNumRows($res2); echo(""); $row2 = msqlFetchRow($res2); while (#$row2 > 0) { $business_name = sub($row2[2],"\"",""); $file_name = "/usr/local/apache2.2/htdocs/take-away/adverts/" + $row2[0] + ".txt"; $sbuf = stat("$file_name"); if (#$sbuf > 0) { echo("

"); echo("$row2[2]
"); $their_postcode = $row2[6]; $their_address = $row2[3] + "," + $row2[4] + "," + $row2[5] + "," + $their_postcode; echo("
$row2[3] $row2[4]
$row2[5] $row2[6]
$row2[7]
"); echo("map
"); $fd = open("$file_name", "<"); if ($fd < 0) { echo("File not found: $record_no.txt $ERRMSG\n"); } else { echo("
"); close($fd); } echo("
"); } else { echo("$row2[2]"); $their_postcode = $row2[6]; $their_postcode = urlEncode($their_postcode); $their_address = $row2[3] + "%20" + $row2[4] + "%20" + $row2[5] + "%20" + $their_postcode; echo("
$row2[3] $row2[4]
$row2[5] $row2[6]

$row2[7]


"); echo("map

"); } $counter++; $row2 = msqlFetchRow($res2); } msqlFreeResult($res2); $row = msqlFetchRow($res); } msqlFreeResult($res); } >