Hi I’m trying to add a where clause to the below query, for some reason it not working when a town is selected
I’m getting a sql error
here is there error
SQL Error: SELECT event_date FROM calendar_events WHERE event_community = South Porcupine GROUP BY event_date ORDER BY event_date
[code=php]
<form name=”changeCommunity” method=”post” action=”<?php echo
$PHP_SELF; ?>”>
<select name=”ChangeCommunity” onchange=”this.form.submit()”>
<option value=”Cochrane”>Cochrane</option>
<option value=”Timmins”>Timmins</option>
<option value=”South Porcupine”>South Porcupine</option>
<option value=”Kapuskasing”>Kapuskasing</option>
<option value=”Smooth Rock Falls”>Smooth Rock Falls</option>
<option value=”Iroquois Falls”>Iroquois Falls</option>
<option value=”Other”>Other</option>
</select>
</form>
<?php
$community = $_POST[‘ChangeCommunity’];
if(isset($_POST[‘ChangeCommunity’])){
$where = “WHERE event_community = $community”;
}else{
}
$sql = “SELECT event_date FROM calendar_events $where GROUP BY event_date ORDER BY event_date”;
$qry = mysql_query($sql) or die(“SQL Error: $sql<br” . mysql_error());