hi
now ive been trying to get this search query for ages now and i cant seem to spot wot is wrong with it
have i just over looked something really simple or am i just doing it all wrong?
the query is to select options from a drop down box which is on a search page and then those selections are meant to be shown on this search results page.
the thing is that i dont have the drop down boxes on the search results page, is it ok to link it from the previous page? ive linked it using the form post method at the moment
and shud i put the query on the search page or the search results page?
the query now looks like:
self = $_SERVER['PHP_SELF'];
$type = $_POST["select_type"];
$sleeps = $_POST["select_sleeps"];
$board = $_POST["select_board"];
$description = $_POST["description"];
$pets_allowed = $_POST["select_pets_allowed"];
$query = "SELECT type, sleeps, board, description, pets_allowed FROM accommodation WHERE type = '$type' AND sleeps = '$sleeps' AND board = '$board' AND description= '$description' AND pets_allowed = '$pets_allowed'";
$result = mysql_query ($query) or die(mysql_error());
$num = mysql_num_rows($result);
if ($num > 0){
echo "<p>There is currently $num accommodation. </p>\n";
echo '<table align = "center" border = "1" cellspacing = "0" cellpadding = "5">
<tr>
<td align="left"><b>Type</b></td>
<td align="left"><b>Sleeps</b></td>
<td align="left"><b>Board</b></td>
<td align="left"><b>Description</b></td>
<td align="left"><b>Pets Allowed</b></td>
</tr>
';
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo '
<tr>
<td align="left">'. $row['type']. '</td>
<td align="left">'. $row['sleeps']. '</td>
<td align="left">'. $row['board']. '</td>
<td align="left">'. $row['description']. '</td>
<td align="left">'. $row['pets_allowed']. '</td>
</tr>
';
}
echo '</table>';
mysql_free_result($result);
} else {
echo '<p class = "error">There are currently no types of accommodation for the choices entered.</p>';
}
mysql_close();
$statment =mysql_query ("SELECT * FROM accommodation WHERE type = '$type' AND sleeps = '$sleeps' AND board = '$board' AND pets_allowed = '$pets_allowed'");
print $statment;
$query = mysql_query($statment) or die(mysql_error());
?>
at the moment it just tells me that query is empty
hope some1 can help