this is the code I had running on our old server and it worked perfectly:
<?php include("header.inc"); ?>
<table width="100%" border="0">
<tr valign="top">
<td height="79" valign="middle"><p> </p>
</td>
<td width="34%" height="79" align="center" valign="middle"> <span class="subheading">AVAILABILITY</span></td>
</tr>
</table>
<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#999999">
<tr bgcolor="#999999" class="tabletitle">
<td width="17%" height="20">Property address</td>
<td width="9%">Floor(s)</td>
<td width="9%">Area (sq ft)</td>
<td width="9%">Area (sq m)</td>
<td width="9%">Rent (£ psf)</td>
<td width="9%">Rates (£ psf)</td>
<td width="9%">S/C (£ psf)</td>
<td width="19%">Specification</td>
<td width="10%">Contact / Details</td>
</tr>
<?php include("mysql.inc") ?>
<?php
// below - selected by postcode or all
if ( !empty($minarea) and !empty($maxarea) and $pc!="All" ) { $sql = "EXPLAIN SELECT * FROM av WHERE ((postcode = '$pc') AND (areasf <= '$maxarea') AND (areasf >= '$minarea')) ORDER BY areasf ASC"; }
elseif ( empty($minarea) and empty($maxarea) and $pc!="All" ) { $sql = "SELECT * FROM av WHERE postcode = '$pc' ORDER BY areasf ASC"; }
elseif ( empty($minarea) and empty($maxarea) and $pc="All" ) { $sql = "SELECT * FROM av ORDER BY areasf ASC"; }
// below - selected by postcode and maxarea
elseif ( $pc!="All" and empty($minarea) and !empty($maxarea) ) { $sql = "SELECT * FROM av WHERE postcode = '$pc' AND areasf <= '$maxarea' ORDER BY areasf ASC"; }
// below - selected by postcode and minarea
elseif ( $pc!="All" and empty($maxarea) and !empty($minarea) ) { $sql = "SELECT * FROM av WHERE ((postcode = '$pc') AND (areasf >= '$minarea')) ORDER BY areasf ASC"; }
// below - selected by maxarea and minarea
elseif ( $pc="All" and !empty($maxarea) and !empty($minarea) ) { $sql = "SELECT * FROM av WHERE ((areasf >= '$minarea') AND (areasf <= '$maxarea')) ORDER BY areasf ASC"; }
// below - selected by maxarea
elseif ( $pc="All" and empty($minarea) and !empty($maxarea) ) { $sql = "SELECT * FROM av WHERE areasf <= '$maxarea' ORDER BY areasf ASC"; }
// below - selected by minarea
elseif ( $pc="All" and empty($maxarea) and !empty($minarea) ) { $sql = "SELECT * FROM av WHERE areasf >= '$minarea' ORDER BY areasf ASC"; }
// below - selected by postcode and maxarea and minarea
else { $sql = "SELECT * FROM av WHERE ((postcode = '$pc') AND (areasf <= '$maxarea') AND (areasf >= '$minarea')) ORDER BY areasf ASC"; }
$result = mysql_query( $sql, $link );
while ( $newArray = mysql_fetch_array($result) )
{
$cellcolor = ($i++ & 1) ? '#eeeeee' : '#ffffff';
$id = $newArray['id'];
$date_time = $newArray['date_time'];
$date_time=date('d M Y, H:i',strtotime($date_time));
$address = $newArray['address'];
$photo = $newArray['photo'];
$postcode = $newArray['postcode'];
$floor = $newArray['floor'];
$areasf = $newArray['areasf'];
$areasm = ($areasf/10.7639);
$areasf = number_format($areasf);
$areasm = number_format($areasm, 2);
$rent = $newArray['rent'];
$rates = $newArray['rates'];
$service = $newArray['service'];
$spec_1 = $newArray['spec_1'];
$spec_2 = $newArray['spec_2'];
$spec_3 = $newArray['spec_3'];
$spec_4 = $newArray['spec_4'];
$spec_5 = $newArray['spec_5'];
$spec_6 = $newArray['spec_6'];
$spec_7 = $newArray['spec_7'];
$spec_8 = $newArray['spec_8'];
$spec_9 = $newArray['spec_9'];
$spec_10 = $newArray['spec_10'];
$spec_11 = $newArray['spec_11'];
$spec_12 = $newArray['spec_12'];
$spec_13 = $newArray['spec_13'];
$spec_14 = $newArray['spec_14'];
$email = $newArray['email'];
$details = $newArray['details'];
print "
<tr>
<td class=\"text\" bgcolor=$cellcolor>$address, London $postcode";
if ( !empty( $photo ) ) { print "<p><img src=\"photos/$photo\"></p>"; }
print " </td>
<td class=\"text\" bgcolor=$cellcolor>$floor</td>
<td class=\"text\" align=center bgcolor=$cellcolor>"; if ( $areasf != "0.00") { print "$areasf"; } else { print "tbc"; } print "</td>
<td class=\"text\" align=center bgcolor=$cellcolor>"; if ( $areasm != "0.00") { print "$areasm"; } else { print "tbc"; } print "</td>
<td class=\"text\" align=center bgcolor=$cellcolor>"; if ( $rent != "0.00") { print "$rent"; } else { print "tbc"; } print "</td>
<td class=\"text\" align=center bgcolor=$cellcolor>"; if ( $rates != "0.00") { print "$rates"; } else { print "tbc"; } print "</td>
<td class=\"text\" align=center bgcolor=$cellcolor>"; if ( $service != "0.00") { print "$service"; } else { print "tbc"; } print "</td>
<td class=\"text\" align=center bgcolor=$cellcolor>";
if ( $spec_1 != "" ) { print "air-conditioning<br>"; }
if ( $spec_2 != "" ) { print "raised floors<br>"; }
if ( $spec_3 != "" ) { print "comfort cooling<br>"; }
if ( $spec_4 != "" ) { print "underfloor trunking<br>"; }
if ( $spec_5 != "" ) { print "central heating<br>"; }
if ( $spec_6 != "" ) { print "perimetre trunking<br>"; }
if ( $spec_7 != "" ) { print "24 hour access<br>"; }
if ( $spec_8 != "" ) { print "Cat 2 lighting<br>"; }
if ( $spec_9 != "" ) { print "24 hour security<br>"; }
if ( $spec_10 != "" ) { print "LG3 lighting<br>"; }
if ( $spec_11 != "" ) { print "passenger lifts<br>"; }
if ( $spec_12 != "" ) { print "refurbished<br>"; }
if ( $spec_13 != "" ) { print "period building<br>"; }
if ( $spec_14 != "" ) { print "kitchenette<br>"; }
print "
</td>
<td class=\"text\" align=center bgcolor=$cellcolor><a href=mailto:$email?subject=Email%20submission%20from%20hexellwylie.com>e-mail</a>";
if ( !empty( $details ) ) { print "<p><a target=\"_blank\" href=details/$details><img src=\"pdficon.gif\"></a></p>"; }
print " </td>
</tr>";
}
mysql_close( $link );
?>
</table>
<p align="right"><a target="_blank" href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="getacro.gif"></a></p>
<?php if ( empty( $id ) ) { print "<br>There are no entries matching your requirement in the database.<br>Please contact Hexell Wylie on 020 7489 9988 for further information."; } ?>
<p> </p>
<?php include("footer.inc"); ?>
I have moved to a server running MySQL 4.0.24-standard, and I get the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/fhlinux202/h/hexellwylie.com/user/htdocs/availability.php on line 40
Line 40 is
while ( $newArray = mysql_fetch_array($result) )
Many thanks for any solution would be most appreciated!!!
rupert
hexellwylie.com