| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/sceupdate.php |
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/php/inc_db.php");
$sql = "SELECT SchoolEvents.EventID, SchoolEvents.EventName, SchoolEvents.EventDescription, MIN(EventSchedules.ScheduleDate) AS StartDate,
MAX(EventSchedules.ScheduleDate) AS EndDate
FROM SchoolEvents
INNER JOIN EventSchedules ON SchoolEvents.EventID=EventSchedules.EventID
WHERE Cancelled=0 AND WebCategory<>11
GROUP BY SchoolEvents.EventID, SchoolEvents.EventName, SchoolEvents.EventDescription
HAVING StartDate >= '2019-01-01'
ORDER BY EventName, StartDate";
$queryresult = mysql_query($sql) or die(mysql_error() . " " . $sql);
if (mysql_num_rows($queryresult) > 0) {
?>
<table border="1" cellspacing="0" cellpadding="5" width="100%">
<?php
while ($row = mysql_fetch_assoc($queryresult)) {
?>
<tr>
<td><a href="https://www.cesa.co.za/node/110?id=<?php echo $row["EventID"]; ?>"><?php echo $row["EventName"]; ?></a></td>
<td nowrap="nowrap"><?php echo date("d F", strtotime($row["StartDate"]));
if ($row["EndDate"] != $row["StartDate"]) echo "<br>to<br>" . date("d F", strtotime($row["EndDate"]));
?>
</td>
<td>
<?php
$newdescrip = preg_replace('/(<[^>]*) style=("[^"]+"|\'[^\']+\')([^>]*>)/i', '$1$3', strip_tags($row["EventDescription"], "<table><tr><th><td><p><b><ul><ol><li><br><br /><i><u>"));
echo $newdescrip;
mysql_query("UPDATE SchoolEvents SET EventDescription='" . addslashes($newdescrip) . "' WHERE EventID=" . $row["EventID"]);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
echo "No results found";
}
include_once($_SERVER['DOCUMENT_ROOT'] . "/php/templates/inc_footer.php");