I will try to describe my problem as accurately as possible.
This is a simplified version of my query.
$query = "SELECT * FROM listings";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$location = $row['location'];
$propertyID = $row['propertyID'];
$query = "SELECT min(day) from rates where propertyid=$propertyID";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
echo $row[0];
}}
Table 'rates' resembles to something like this.
PropertyId | Season | Day | Week | Month
1234 | December | 50 | 100 | 1000
1234 | January | 60 | 110 | 1100
1234 | March | 70 | 120 | 1200
1234 | April |80 | 140 | 1300
1234 | June |90 | 150 | 1400
3142 | December |40 | 110 | 1500
3142 | January |20 | 120 | 1300
3142 | March | 90 | 130 | 1400
3142 |April | 40 | 160 | 1600
3142 |June | 50 | 150 | 1800
I need to output all my listings while querying the min(day) for each properties. My current code outputs 1 listing and stops, instead of outputting all my listings, and query min(day) for each.
Thanks for your help. This is driving me nuts.