My php script runs and no errors are generated - it's just that the query to the database does not display any results? The code works on public website (obviously with different host, user, password etc)?
<?php
$con = mysql_connect("localhost","root",""
;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ccn", $con);
$sleepers = $_POST["sleepnum"];
if ($sleepers==""
{
$sql = "SELECT * FROM properties";
} else {
$sql = "SELECT * FROM properties WHERE sleeps = '".$sleepers."'";
echo "Searching for: ".$sleepers."<br>";
}
//echo $sql."<br>";
?>
<table width="800" border="1">
<?php
$num_rows = 0;
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td> <?= $row['name']; ?> </td>
<td> <?= $row['area']; ?> </td>
<td> <?= $row['city'] ?> </td>
<td> <?= $row['county'] ?> </td>
<td> <?= $row['postcode'] ?> </td>
<td> <?= $row['sleeps'] ?> </td>
<td> <?= $row['bedrooms'] ?> </td>
</tr>
<?php
$num_rows++;
}
mysql_close($con);
?>
</table>
<?=$num_rows?> results found.