Can anyone help me out, I'm struggling with returning some results from mysql
Basically I am doing a search for a villa, given specific parameters which is fine.
My problem comes when I try and return the matches. When the results are returned the search iterates through the correct villa ids but returns the same name for all the villas.
E.g:
17 - Ca’n Toni
50 - Ca’n Toni
94 - Ca’n Toni
95 - Ca’n Toni
259 - Ca’n Toni
265 - Ca’n Toni
Which should be something like:
17 - Ca’n Toni
50 - Villa Mosson
94 - Villa Camp del Bosch
95 - Poletas 2 Eva
259 - Villa Pedra Vista
265 - Villa C’al Perdiu
Here is the code I am using to run the search:
mysql_select_db($database_conVillas, $conVillas);
$sql = "SELECT * FROM villas, pricing1 WHERE villas.resort = 'pollenca' AND villas.beds LIKE '%%' AND pricing1.week = '03-01-04' AND pricing1.price != '0'";
$sql_result = mysql_query($sql) or die(mysql_error());
$num_rows = mysql_num_rows($sql_result);
if ($num_rows == 0){
echo 'Sorry your search did not return any results. Please return to the search page <a href=search.php>here</a>';
} else {
while($row = mysql_fetch_array($sql_result)){
echo $row["ID"] . " - " .$row["Name"];
echo "<p>";
}
}
Any ideas, as usual I am stumped?