PHP mysql query help
Posted: Wed Nov 22, 2006 10:22 am
Quick question i have the blow my sql query set up and i need some help adding an extra criteria
I currently have a variable $listingid and for the sake of this moment lets say the value is 10
and a field in the table called listing_id
i want to add a extra criteria to the above query that says
SELECT * FROM calendar_events WHERE event_date = '$year-$month-$day
and
where listing_id = $listingid
so basicly i want all event dates where listing_id = $listingid
im just not sure how to write it in. any help would be appricated
Code: Select all
$sql = mysql_query("SELECT * FROM calendar_events WHERE event_date = '$year-$month-$day'");
if (mysql_num_rows($sql) > 0) {
while ($e = mysql_fetch_array($sql)) {
echo "<p>$e[event_avalibility]</p>\n";
}
} else {
echo "<p>No events today</p>\n";
}and a field in the table called listing_id
i want to add a extra criteria to the above query that says
SELECT * FROM calendar_events WHERE event_date = '$year-$month-$day
and
where listing_id = $listingid
so basicly i want all event dates where listing_id = $listingid
im just not sure how to write it in. any help would be appricated