2025 – South Carolina Calendar of Events, Festivals
More SC Festivals, Events
DATE |
EVENT |
CITY |
TYPE |
include('config.php');
function incision_sort($arr, $col){
for($k = 0; $k < sizeof($arr)-1; $k++){
// $arr[$k+1] is possibly in the wrong place. Take it out.
$t = $arr[$k+1];
$i = $k;
// Push $arr[i] to the right until we find the right place for $t.
while($i >= 0 && $arr[$i][$col] > $t[$col]){
$arr[$i+1] = $arr[$i];
$i--;
}
// Insert $t into the right place.
$arr[$i+1] = $t;
}// End sort
return $arr;
}
function subval_sort($a,$subkey) {
foreach($a as $k=>$v) {
$b[$k] = strtolower($v[$subkey]);
}
asort($b);
foreach($b as $key=>$val) {
$c[] = $a[$key];
}
return $c;
}
function getDaysInBetween($start, $end) {
$range = array();
if (is_string($start) === true) $start = strtotime($start);
if (is_string($end) === true ) $end = strtotime($end);
do {
$range[] = date('Y-m-d', $start);
$start = strtotime("+ 1 day", $start);
} while($start <= $end);
return $range;
}
$result = mysql_query("SELECT * FROM `z_calendar` WHERE year(startdate)='$year' and month(startdate)='$month'") or trigger_error(mysql_error());
echo "";
while($row = mysql_fetch_array($result)){
foreach($row AS $key => $value) { $row[$key] = stripslashes($value); }
$daynumber = date("j",strtotime( $row['startdate']));
$thestartdate = date("j",strtotime( $row['startdate']));
$theenddate = date("j",strtotime( $row['enddate']));
$duration = getDaysInBetween($row['startdate'],$row['enddate']);
#echo count($duration);
#print_r($duration);
foreach($duration as $individualday){
$row['individualday']= $individualday;
$newdaynumber = date("j",strtotime( $individualday));
$days["$newdaynumber"][] = array($row);
}
ksort($days);
}
$startct = 0;
#print_r($days);
$TbaEvents = array();
$keys = array_keys($days);
$numdaysmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year) + 1;
echo "";
for ($jj = 1; $jj < $numdaysmonth; $jj++) {
if (! $days[$jj]) {
$days[$jj] = '';
}
}
ksort($days);
foreach ($days as $i => $values) {
if(!$values){
$newmonth = $month;
$newday = $i;
if($newmonth < 10)
$newmonth = "0".$newmonth;
if($newday < 10)
$newday = "0".$newday;
echo "\n\n";
echo " | ";
echo " | | | ";
}else{
$narray = array();
$numofvalues = sizeof($values);
foreach ($values as $key => $value) {
$narray[$key] = $value[0];
}
$sortarray=incision_sort($narray,1);
foreach($sortarray as $sarr){
if($sarr['tba'] == ''){
if($sarr['area']){
$thisarea = " {$sarr['area']}";
}else{
$thisarea='';
}
echo "\n\n";
echo " ";
echo date("l",strtotime( $values[0][0]['individualday']));
echo " ";
echo date("M",strtotime( $values[0][0]['individualday']));
echo " ";
echo "$i";
echo " | ";
if($sarr['image']){
$thisimage = "";
}else{
$thisimage = "";
}
echo " | {$sarr['city']}$thisarea | {$sarr['type']} | ";
}else{
$TbaEvents[] = $sarr;
}
}
}
}
if(sizeof($TbaEvents) > 0){
$TbaEvents=incision_sort($TbaEvents,1);
foreach($TbaEvents as $tba){
echo "
Dates TBD |
| ";
echo "{$tba['city']} | {$tba['type']} | ";
}
}
?>
|