$query = "SELECT * FROM trending_Event, trending_Showing\n\t\t\t\t\tWHERE trending_Event.EventID = trending_Showing.EventID\n\t\t\t\t\tAND trending_Event.trendingStatus = 1\n\t\t\t\t\tAND trending_Showing.Available > 0\n\t\t\t\t\tORDER BY trending_Event.TotalSold DESC, trending_Showing.ShowingStartDate"; $result = mysql_query($query, $con); $phpResponseTrending = array(); // this variable updates the latest EVENT Name $temp = ""; // this variable keeps a count on the number of EVENTS stored in array // we need to limit this count to 5 $count = 0; while ($count < 5 && ($row = mysql_fetch_assoc($result))) { $Name = $row['Name']; // convert $ShowingDateTime to array by Leon 2014/09/23 $ShowingStartDate = $row['ShowingStartDate']; $showingDateTime = dateTimeToArray($ShowingStartDate, 1); // If the EVENT is not already stored, save the required details // Event's $showingDateTime don't pass current Date. by Leon 2014/09/23 if (isLess($currDateTime, $showingDateTime) == -1 && $temp != $Name) { $count++; $temp = $Name; $TabletLink = $row['TabletLink']; $TotalSold = $row['TotalSold']; $ShowingVenueName = $row['ShowingVenueName']; $phpResponseTrending[] = array("Name" => $Name, "TabletLink" => $TabletLink, "TotalSold" => $TotalSold, "StartDate" => $ShowingStartDate, "VenueName" => $ShowingVenueName); } } // Print the data along with the generation of XMLFiles file, if needed echo "<pre>"; print_r($phpResponseTrending); echo "</pre>"; // --------------------------------------------------------------------- // // Generating XMLFiles file from PHP array // --------------------------------------------------------------------- //
$xml_ticketing = simplexml_load_file("https://prod5.agileticketing.net/API/Admin.svc/XML/EventGetSalesSummary?appkey=d09b3053-1817-4665-b41f-e1987e14433a&userkey=0fd55f05-bf17-4b48-bbff-12cd842830de&corporgid=2198&eventOrgID=2229&eventID=" . $ShowingID); // Save the ticketing details for each SHOWING, in PHP variables $Available = $xml_ticketing->Available; $Disabled = $xml_ticketing->Disabled; $Sold = $xml_ticketing->Sold; $InProcess = $xml_ticketing->InProcess; // Set RushStatus of SHOWING //Removed 20140216 (MO) $showingDateTime = dateTimeToArray($ShowingStartDate, 1); if ($Available == 0 || isLess($currDateTime, $showingDateTime) != -1) { $RushStatus = 1; } else { $RushStatus = 0; } // Set TrendingStatus of EVENT if (isLess($currDateTime, $showingDateTime) == -1) { $TrendingStatus = 1; } else { $TrendingStatus = 0; } // $TotalSold = $TotalSold + $Sold; // Query to check if there exists any data in the Showing table to // determine if the data saved from XMLFiles needs to be inserted or updated $query = "SELECT * FROM trending_Showing WHERE ShowingID=" . $ShowingID; $result = mysql_query($query, $con); $row = mysql_fetch_assoc($result); $ShowingUpdate = 0; // update Showing table 20140216 (MO) removed RushStatus=".$RushStatus." // add RushStatus=".$RushStatus." by Leon 2014/09/23 if ($row['ShowingID'] == $ShowingID) {