I'm getting :
Parse error: syntax error, unexpected '[', expecting ']' in path removed on line 115
Here's the code... Line 115 is near the bottom.
<?php
// Yeah... Josh's Function Include for www.NighttimeVIP.com
// Functions herein are the Intelectual property of Kurtis Wadell and may not be used
// copied or otherwise defiled without his express permission.
function compare($x, $y)// this function is used for a Usort later on.
{
if ( $x[0] == $y[0] )
return 0;
else if ( $x[0] < $y[0] )
return -1;
else
return 1;
}
function searchDateDB($searchMethod = "all", $seartchString = "all", $pastDates = "0"){
// This function will search the NTVIP db for events, then after organizing it will return an array with the data formatted in a specific fashion.
// thus this function should be used as such:
// $returnedArray = searchDateDB('all', 'all', 0);
// Methods available are: "all", "date", "name", it is unnessary when using an "ALL"
// search String is a string of text or a date formatted in YYYY-MM-DD, it is optionally unnecessary when using an ALL
// pastDates is: 0 no past dates, 1 include past dates, 2 only past dates. NOTE: there is no divider for past dates at theis point
$todaysDate = date("Ymd", (time() - 7200)); // todays date, adjusted to PST from server CST:
if($pastDates == 0){// exclude older dates.
$startingDate = $todaysDate;
$endingDate = "99999999"; // AKA the end of TIME!!!! muhahahaha
}elseif($pastDates == 1){// all dates
$startingDate = "0"; // AKA the BEGINING OF TIME...
$endingDate = "99999999"; // AKA the end of TIME!!!! muhahahaha
}elseif($pastDates == 2){// ONLY past dates
$startingDate = "0"; // AKA the BEGINING OF TIME...
$endingDate = $todaysDate - 1; // AKA the end of TIME!!!! muhahahaha
}
$sqlCounter = 1;
if($searchMethod == "all"){
$sql[0] = "SELECT * FROM events;";
}elseif($searchMethod == "name"){
// search for exact matches "*string*"
$sql[0] = "SELECT * FROM events WHERE name LIKE '%".$searchString."%' ORDER BY name;";
// now break up the search into individual words and search the individual words.
$baBoom = explode(" ", $searchString);
if ($baBoom[0] == $searchString){
do{
$sql[$sqlCounter] = $baBoom[($sqlCounter - 1)];
$sqlCounter++;
}while($baBoom[$sqlCounter]);
}
}elseif($searchMethod == "date"){
$sql[0] = "SELECT * FROM events;";
}
//now that we've build a list of sql searches...
//we search and build an array with the data
//the 1st element will always be a smashed version of the date so it can be sorted by date.
$eventResultCounter = 0;
for($looper = 0; $looper < $sqlCounter; $looper++){
$result = mysql_query($sql[$looper]);
if ($myrow = mysql_fetch_array($result)) {
do{
if($alreadyHitArray[$myrow['id']] != 1){ // already hit array is an array that marks if an id has already been stored
$explodeRoot = explode("|!|", $myrow['dateTimeString']); // dateTimeString holds multiple dates, gotta seperate
$iLoop = 0;
while($explodeRoot[$iLoop]){ // the while loop allows us to itterate though all dates, usually there will be only 1
$explode = explode("|-|", $explodeRoot[$iLoop]);
$dateExplode = explode("-", $explode[0]);
$dateSmashed = sprintf("%s%s%s", addLeadingZeros($dateExplode[0]), addLeadingZeros($dateExplode[1]), addLeadingZeros($dateExplode[2]));
if(($dateSmashed >= $startingDate) && ($dateSmashed <= $endingDate)){ // checks for date relevance
$Array[$eventResultCounter][0] = $dateSmashed;
if($Array[$eventResultCounter][0] == $searchString){
$Array[$eventResultCounter][1] = "1"; // does the date match the searchdate?
}else{
$Array[$eventResultCounter][1] = "0";
}
$Array[$eventResultCounter][2] = $dateExplode[0];
$Array[$eventResultCounter][3] = $dateExplode[1];
$Array[$eventResultCounter][4] = $dateExplode[2];
$Array[$eventResultCounter][5] = $myrow['id'];
$Array[$eventResultCounter][6] = $myrow['name'];
$Array[$eventResultCounter][7] = $myrow['description'];
$Array[$eventResultCounter][8] = $myrow['urlName'];
$Array[$eventResultCounter][9] = $myrow['clubid'];
$eventResultCounter++;
}
` $iLoop++;
}
$alreadyHitArray[$myrow['id']] = 1;
}
}while($myrow2 = mysql_fetch_array($result));
}
}
usort($EventArray, 'compare'); // sort by date
return $EventArray;
}
$alreadyHitArray[$myrow['id']] = 1;
is the problem line.
-Thanks