I get this error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(date_time) AS date, TIME(date_time) AS time, id, subject, html
I'm using the following code:
$sql = "SELECT DATE(date_time) AS date, TIME(date_time) AS time, id, subject FROM `tbl_calendar` WHERE date_time BETWEEN CURDATE() AND DATE_ADD(CURDATE(),INTERVAL 30 DAY)";
$query = mysql_query($sql) or die(mysql_error());
$num_rows = mysql_num_rows($query);
?>
<p>Upcoming Events</p>
<?php
if($num_rows == 0)
{
?>
<p>There are no events in the next month.</p>
<?php
}else{
while($row = mysql_fetch_array($query))
{
?>
<p><a href="calendar.php?id=<?php echo $row['id']; ?>"><?php echo $row['subject']; ?></a>:
<?php echo $row['date']; ?> at <?php echo $row['time']; ?></p>
<?php
}
}
?>