PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
-- Create the Events table CREATE TABLE Events ( id INT AUTO_INCREMENT PRIMARY KEY, Author INT NOT NULL, Title VARCHAR(255) NOT NULL, Description TEXT NOT NULL, Start DATETIME NOT NULL, End DATETIME NOT NULL, Button VARCHAR(255) DEFAULT "", URL VARCHAR(255) NOT NULL, Location VARCHAR(255) NOT NULL, Location_URL VARCHAR(255) NOT NULL, `Virtual` TINYINT NOT NULL, Multiple_dates TINYINT DEFAULT 0, Created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, Modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Recurring TINYINT DEFAULT 0, On_Demand TINYINT DEFAULT 0 ) ENGINE=InnoDB; -- Create the Events_Vendors table CREATE TABLE Events_Vendors ( vid INT AUTO_INCREMENT PRIMARY KEY, Code VARCHAR(3) DEFAULT "", Vendor VARCHAR(255) NOT NULL ) ENGINE=InnoDB; -- Create the Events_Vendors_Tags table CREATE TABLE Events_Vendors_Tags ( event_id INT NOT NULL, vendor_id INT NOT NULL, PRIMARY KEY (event_id, vendor_id) -- FOREIGN KEY (event_id) REFERENCES Events(id) ON DELETE CASCADE, -- FOREIGN KEY (vendor_id) REFERENCES Events_Vendors(vid) ON DELETE CASCADE ) ENGINE=InnoDB; -- Create the Events_Countries table CREATE TABLE Events_Countries ( cid INT AUTO_INCREMENT PRIMARY KEY, Code VARCHAR(3) DEFAULT "", Country VARCHAR(255) NOT NULL ) ENGINE=InnoDB; -- Create the Events_Countries_Tags table CREATE TABLE Events_Countries_Tags ( event_id INT NOT NULL, country_id INT NOT NULL, PRIMARY KEY (event_id, country_id) -- FOREIGN KEY (event_id) REFERENCES Events(id) ON DELETE CASCADE, -- FOREIGN KEY (country_id) REFERENCES Events_Countries(cid) ON DELETE CASCADE ) ENGINE=InnoDB; -- Insert sample events INSERT INTO Events (Author, Title, Description, Start, End, URL, Location, Location_URL, `Virtual`, Multiple_dates, Recurring, On_Demand) VALUES (1, 'Event 1', 'Description for Event 1', '2024-01-01 10:00:00', '2024-01-01 12:00:00', 'https://event1.com', 'Location 1', 'https://location1.com', 1, 0, 0, 0), (2, 'Event 2', 'Description for Event 2', '2024-02-01 10:00:00', '2024-02-01 12:00:00', 'https://event2.com', 'Location 2', 'https://location2.com', 0, 0, 0, 0); -- Insert sample vendors INSERT INTO Events_Vendors (Vendor, Code) VALUES ('Avaya','ava'), ('Cisco','cis'), ('Extreme','ext'); -- Insert sample vendor-event relationships INSERT INTO Events_Vendors_Tags (event_id, vendor_id) VALUES (1, 1), (1, 2), (2, 3); -- Insert sample countries INSERT INTO Events_Countries (Country, Code) VALUES ('Singapore','sg'), ('UK','uk'), ('Germany','de'); -- Insert sample country-event relationships INSERT INTO Events_Countries_Tags (event_id, country_id) VALUES (1, 1), (1, 2), (2, 3);
Copy Clear
Copy Format Clear
<?php ini_set('display_errors', 'On'); ini_set('default_charset', 'utf-8'); error_reporting(E_ALL); include 'connection.php'; $mockEvents = `[ { id: "8002", Author: "523", Title: "SkillBoost Bootcamp - PSE: Prisma Cloud Professional", Description: "Get ready to tackle your PSE: Prisma Cloud Professional exam in just 1 day with this SkillBoost Bootcamp. Earn 30 Tech Xpert points when you attend this session!", Start: "2025-06-04T08:30:55Z", End: "2025-06-04T11:30:55Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:39:29", Modified: "2024-08-23 08:39:29", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "7999", Author: "523", Title: "Incident & Response with Cortex", Description: "Learn how Cortex XDR can be used after an incident to rapidly recover from the attack. Earn 15 Tech Xpert points when you attend this session!", Start: "2025-05-21T08:30:47Z", End: "2025-05-21T09:30:47Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:37:38", Modified: "2024-08-23 08:37:38", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8001", Author: "523", Title: "Prisma Cloud Assessment Walkthrough", Description: "Explore how to execute a Palo Alto Networks Prisma Cloud Assessment to assess your customers\u2019 current cloud security environments. Earn 20 Tech Xpert points when you attend this session!", Start: "2025-05-20T08:30:20Z", End: "2025-05-20T10:00:20Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:38:52", Modified: "2024-08-23 08:38:52", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "7988", Author: "523", Title: "SkillBoost Bootcamp \u2013 PSE: Software Firewall Professional", Description: "Get ready to tackle your PSE: Software Firewall Professional exam in just 1 day with this SkillBoost Bootcamp. Earn 30 Tech Xpert points when you attend this session!", Start: "2025-05-14T08:30:14Z", End: "2025-05-14T11:30:14Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:19:59", Modified: "2024-08-23 08:19:59", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "7998", Author: "523", Title: "SkillBoost Bootcamp: PSE: Cortex Professional", Description: "Get ready to tackle your PSE: Cortex Professional exam in just 1 day with this SkillBoost Bootcamp. Earn 30 Tech Xpert points when you attend this session!", Start: "2025-05-08T08:30:08Z", End: "2025-05-08T11:30:08Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:36:44", Modified: "2024-08-23 08:36:44", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8205", Author: "554", Title: "#France - Pr\u00e9pa PSE Prisma Cloud - Workshop + CTF", Description: "Vous connaissez d\u00e9j\u00e0 tr\u00e8s bien Palo Alto Networks et souhaitez pr\u00e9parer rapidement vos certifications avant vente alors n\\'h\u00e9sitez pas \u00e0 nous rejoindre \u00e0 nos diff\u00e9rents programme.", Start: "2025-04-25T08:00:08Z", End: "2025-04-25T15:00:08Z", Button: "", URL: "https://westconcomstor.webex.com/webappng/sites/westconcomstor/webinar/webinarSeries/register/ea801dc6033e49b4945424cb7a893804", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-18 09:45:46", Modified: "2024-10-18 09:45:46", vendors: "15,163", countries: "15", }, { id: "8000", Author: "523", Title: "SkillBoost \u2013 PSE: Prisma Cloud Professional", Description: "Get ready to tackle your PSE: Prisma Cloud Professional exam in just 5 weeks with this SkillBoost track. Earn 50 Tech Xpert points when you attend at least 3 out of 5 sessions!", Start: "2025-04-15T08:30:42Z", End: "2025-05-13T09:30:42Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:38:17", Modified: "2024-08-23 08:38:17", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8336", Author: "602", Title: "DMEA 2025 - Connecting Digital Health", Description: "Die DMEA z\u00e4hlt zu Europa\u2018s wichtigsten Events f\u00fcr Digital Health. Hier treffen sich Expert:innen aus der digitalen Gesundheitswirtschaft in Berlin. Die DMEA bietet allen Akteuren neben einem umfassenden Markt\u00fcberblick vielf\u00e4ltige ...", Start: "2025-04-08T08:00:32Z", End: "2025-04-10T17:00:32Z", Button: "Hier alle Infos", URL: "https://www.dmea.de/de/", Location: "Messe Berlin", Location_URL: "", Virtual: "0", Created: "2024-12-12 09:35:44", Modified: "2024-12-12 09:35:44", vendors: "9,142", countries: "16", }, { id: "7987", Author: "523", Title: "NGFW Basics Crash Course", Description: "Take a crash-course on Palo Alto Networks NGFW and get a handle on the basics in just 1 week. Earn 50 Tech Xpert points when you attend at least 3 out of 5 sessions!", Start: "2025-04-07T08:30:31Z", End: "2025-04-07T09:30:31Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:19:10", Modified: "2024-08-23 08:40:43", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8204", Author: "554", Title: "#France - Pr\u00e9pa PSE Prisma Cloud - Overview", Description: "Vous connaissez d\u00e9j\u00e0 tr\u00e8s bien Palo Alto Networks et souhaitez pr\u00e9parer rapidement vos certifications avant vente alors n\\'h\u00e9sitez pas \u00e0 nous rejoindre \u00e0 nos diff\u00e9rents programme.", Start: "2025-04-04T08:00:14Z", End: "2025-04-04T12:00:14Z", Button: "", URL: "https://westconcomstor.webex.com/webappng/sites/westconcomstor/webinar/webinarSeries/register/ea801dc6033e49b4945424cb7a893804", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-18 09:42:14", Modified: "2024-10-18 09:42:14", vendors: "15,163", countries: "15", }, { id: "7994", Author: "523", Title: "SASE TITAN Session", Description: "Earn your Palo Alto Networks \u201cSASE Titan Trainee\u201d status with ease by following along this session. Earn 30 Tech Xpert points when you attend!", Start: "2025-04-01T08:30:35Z", End: "2025-04-01T11:30:35Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:34:15", Modified: "2024-08-23 08:34:15", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8203", Author: "554", Title: "#France - Pr\u00e9pa PSE Software Firewall - Workshop + CTF", Description: "Vous connaissez d\u00e9j\u00e0 tr\u00e8s bien Palo Alto Networks et souhaitez pr\u00e9parer rapidement vos certifications avant vente alors n\\'h\u00e9sitez pas \u00e0 nous rejoindre \u00e0 nos diff\u00e9rents programme.", Start: "2025-03-28T08:00:45Z", End: "2025-03-28T15:00:45Z", Button: "", URL: "https://westconcomstor.webex.com/webappng/sites/westconcomstor/webinar/webinarSeries/register/ea801dc6033e49b4945424cb7a893804", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-18 09:38:13", Modified: "2024-10-18 09:38:13", vendors: "15,163", countries: "15", }, { id: "8201", Author: "554", Title: "#France - PSE Software Firewall - Overview", Description: "Vous connaissez d\u00e9j\u00e0 tr\u00e8s bien Palo Alto Networks et souhaitez pr\u00e9parer rapidement vos certifications avant vente alors n\\'h\u00e9sitez pas \u00e0 nous rejoindre \u00e0 nos diff\u00e9rents programme.", Start: "2025-03-21T08:00:50Z", End: "2025-03-21T12:00:50Z", Button: "", URL: "https://westconcomstor.webex.com/webappng/sites/westconcomstor/webinar/webinarSeries/register/ea801dc6033e49b4945424cb7a893804", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-18 09:32:39", Modified: "2024-10-18 09:32:39", vendors: "15,163", countries: "15", }, { id: "8315", Author: "303", Title: "Nokia SkillBoost: Network Infrastructure Security", Description: "Learn more about Nokia Network Infrastructure Security with detailed insights into Nokia\\'s solution for securing networks.", Start: "2025-03-20T09:00:20Z", End: "2025-03-20T10:30:20Z", Button: "", URL: "https://p.westconcomstor.com/emea_nok_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-02 15:05:59", Modified: "2024-12-02 15:05:59", vendors: "73,163", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "8362", Author: "80", Title: "PartnerTag mit Infoblox & Westcon", Description: "Freuen Sie sich auf die Experten von Infoblox, eine F\u00fchrung im Koster Seligenstadt, ein gemeinsames Dinner mit Weinverkostung und eine Menge guter Gespr\u00e4che und neuer Informationen.", Start: "2025-03-18T12:00:40Z", End: "2025-03-18T21:00:40Z", Button: "Details & Anmeldung", URL: "https://p.westconcomstor.com/de_inb_partnertag-mrz25.html", Location: "Kloster Seligenstadt", Location_URL: "", Virtual: "0", Created: "2025-01-08 11:22:10", Modified: "2025-01-08 11:22:10", vendors: "20", countries: "16", }, { id: "7993", Author: "523", Title: "SkillBoost Bootcamp \u2013 PSE: SASE Professional", Description: "Get ready to tackle your PSE: SASE Professional exam in just 1 day with this SkillBoost Bootcamp. Earn 30 Tech Xpert points when you attend this session!", Start: "2025-03-18T09:30:42Z", End: "2025-03-18T12:30:42Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:33:22", Modified: "2024-08-23 08:33:22", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8364", Author: "523", Title: "Zero Trust: The Critical Role of DNS", Description: "Explore the principles of Zero Trust, why it\u2019s pivotal for modern networks and cybersecurity, and the essential role of DNS in a successful Zero Trust strategy. Earn 20 Tech Xpert points when you attend!", Start: "2025-03-06T09:30:57Z", End: "2025-03-06T10:15:57Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_eef_tech-xpert-sessions.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 14:54:04", Modified: "2025-01-13 14:54:15", vendors: "187,163", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,5,32,33,35", }, { id: "7992", Author: "523", Title: "Prisma SASE Capture the Flag", Description: "Join us to get hands-on with Palo Alto Networks\u2019 Prisma SASE in this competitive, gamified event. Earn 25 Tech Xpert points when you attend this session!", Start: "2025-03-05T09:30:00Z", End: "2025-03-05T11:00:00Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:32:39", Modified: "2024-08-23 08:32:39", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8237", Author: "15", Title: "Vulnerability Management with Prisma Cloud: Best Practices", Description: "Join this short track series of live webinars featuring sales and technical contents. You will discover how the biggest innovations in Prisma Cloud can help secure customers\\\\\\' Cloud and AI transformation.", Start: "2025-03-04T13:00:47Z", End: "2025-03-04T14:00:47Z", Button: "REGISTER NOW", URL: "https://register.paloaltonetworks.com/vulnerabilitymanagementbestpra", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-24 08:02:19", Modified: "2024-12-09 09:51:21", vendors: "15", countries: "16,10", }, { id: "7991", Author: "523", Title: "Prisma SASE 3D Lab Showcase", Description: "Join us as we showcase our Prisma SASE 3D Lab, so you know exactly how to navigate the environment and use it for your own enablement and customer demos. Earn 15 Tech Xpert points when you attend this session!", Start: "2025-02-20T09:30:14Z", End: "2025-02-20T10:15:14Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:31:56", Modified: "2024-08-23 08:31:56", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8350", Author: "759", Title: "Z-Day - Partnerevent in Frankfurt Zscaler x Westcon", Description: "Beim Z-Day erwartet Sie eine Vielzahl wertvoller Informationen sowohl von Westcon als auch direkt vom Hersteller.\\n\\nDas Westcon-Team wird Ihnen einen \u00dcberlick zu den Support Angeboten von Westcon wie bspw. unsere 3D Labs oder Professional Services. \\n", Start: "2025-02-19T09:00:54Z", End: "2025-02-19T16:00:54Z", Button: "Details & Anmeldung", URL: "https://p.westconcomstor.com/de_zsc_z-day-feb-2025.html", Location: "Zscaler B\u00fcro; Gerveniusstra\u00dfe 17; 60322 Frankfurt am Main", Location_URL: "https://maps.app.goo.gl/Va4eWrCScPvE1BCp6", Virtual: "0", Created: "2024-12-23 12:24:32", Modified: "2024-12-23 12:24:32", vendors: "180", countries: "16", }, { id: "8347", Author: "559", Title: "AI for Networking, enhanced by ecosystem partnerships", Description: "In this session we will give an overview of new partnerships in the manufacturing vertical and how their addition to existing infrastructure together with AI for Networking benefits, can create new business outcomes.", Start: "2025-02-19T09:00:41Z", End: "2025-02-19T09:30:41Z", Button: "Register", URL: "https://arubanetworks.zoom.us/webinar/register/WN_CHKYFiSbQbK_QXcvY9VxaQ#/registration", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-17 14:44:32", Modified: "2024-12-17 14:44:32", vendors: "137", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "8236", Author: "15", Title: "Alert Burndown Methodologies with Prisma Cloud", Description: "Join this short track series of live webinars featuring sales and technical contents. You will discover how the biggest innovations in Prisma Cloud can help secure customers\\\\\\' Cloud and AI transformation.", Start: "2025-02-18T13:00:28Z", End: "2025-02-18T14:00:28Z", Button: "REGISTER HERE", URL: "https://register.paloaltonetworks.com/alertburndownmethodologies", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-24 07:55:46", Modified: "2024-12-09 09:49:40", vendors: "15", countries: "16,10", }, { id: "8314", Author: "303", Title: "Nokia SkillBoost: Data Center Networking Vision & Technology", Description: "Lear more about Nokia Data Center Networking vision and technology and how Nokia Data Center Networking fits in your technology stack. This is part of Nokia SkillBoot sessions for Tech Xpert.", Start: "2025-02-18T09:00:27Z", End: "2025-02-18T10:30:27Z", Button: "", URL: "https://p.westconcomstor.com/emea_nok_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-02 15:01:17", Modified: "2024-12-02 15:01:17", vendors: "73,163", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "8200", Author: "554", Title: "#France - Pr\u00e9pa PSE SASE - Workshop + Capture the Flag", Description: "Vous connaissez d\u00e9j\u00e0 tr\u00e8s bien Palo Alto Networks et souhaitez pr\u00e9parer rapidement vos certifications avant vente alors n\\'h\u00e9sitez pas \u00e0 nous rejoindre \u00e0 nos diff\u00e9rents programme.\\n", Start: "2025-02-14T08:00:05Z", End: "2025-02-14T15:00:05Z", Button: "", URL: "https://westconcomstor.webex.com/webappng/sites/westconcomstor/webinar/webinarSeries/register/ea801dc6033e49b4945424cb7a893804", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-18 09:28:34", Modified: "2024-10-18 09:29:49", vendors: "15,163", countries: "15", }, { id: "8354", Author: "523", Title: "Prisma Cloud Assessment Workshop", Description: "Explore how to execute a Palo Alto Networks Prisma Cloud Assessment to assess your customers\u2019 current cloud security environments. Earn 20 Tech Xpert points when you attend this session!", Start: "2025-02-12T09:30:02Z", End: "2025-02-12T11:00:02Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-24 09:05:40", Modified: "2024-12-24 09:05:40", vendors: "15,163", countries: "9,10,12,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8346", Author: "559", Title: "AI for Networking in Switching ", Description: "In this session we will further explore how AI for Networking is used for our Switching solutions. As well as the growth in Wireless connectivity, we also see many more devices connected through wired connectivity.", Start: "2025-02-12T09:00:05Z", End: "2025-02-12T09:30:05Z", Button: "Register", URL: "https://arubanetworks.zoom.us/webinar/register/WN_VnCSZm5QQ3aQRntc-B1wWg#/registration", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-17 14:41:40", Modified: "2024-12-17 14:41:40", vendors: "137", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "7986", Author: "523", Title: "SkillBoost \u2013 PSE: Software Firewall Professional", Description: "Get ready to tackle your PSE: Software Firewall Professional exam in just 5 weeks with this SkillBoost track. Earn 50 Tech Xpert points when you attend at least 3 out of 5 sessions!", Start: "2025-02-11T09:30:51Z", End: "2025-03-11T10:30:51Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:18:26", Modified: "2024-08-23 08:18:26", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8371", Author: "639", Title: "Zscaler Get Skilled in 4 - Session 4 ", Description: "Westcon 3D Labs (ZIA and ZPA) (Virtual)\\n\\nYou will earn 20 TX points per full session attended ", Start: "2025-02-07T09:00:15Z", End: "2025-02-07T12:00:15Z", Button: "Register now", URL: "https://p.westconcomstor.com/emea_zsc_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 20:55:26", Modified: "2025-01-13 20:55:26", vendors: "163,180", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8199", Author: "554", Title: " #France - Pr\u00e9para PSE SASE - Overview", Description: "Vous connaissez d\u00e9j\u00e0 tr\u00e8s bien Palo Alto Networks et souhaitez pr\u00e9parer rapidement vos certifications avant vente alors n\\'h\u00e9sitez pas \u00e0 nous rejoindre \u00e0 nos diff\u00e9rents programme.", Start: "2025-02-07T08:00:52Z", End: "2025-02-07T12:00:52Z", Button: "", URL: "https://westconcomstor.webex.com/webappng/sites/westconcomstor/webinar/webinarSeries/register/ea801dc6033e49b4945424cb7a893804", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-18 09:22:29", Modified: "2024-10-18 09:22:29", vendors: "15,163", countries: "15", }, { id: "7985", Author: "523", Title: "SkillBoost Bootcamp \u2013 PSE: Hardware Firewall Professional", Description: "Get ready to tackle your PSE: Hardware Firewall Professional exam in just 1 day with this SkillBoost Bootcamp. Earn 30 Tech Xpert points when you attend this session!", Start: "2025-02-06T09:30:02Z", End: "2025-02-06T12:30:02Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-08-23 08:17:48", Modified: "2024-08-23 08:17:48", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8370", Author: "639", Title: "Zscaler Get Skilled in 4 - Session 3", Description: "Zscaler Data Protection Solution (Virtual)\\nZscaler Risk Management Solution \\n\\nYou will earn 20 TX points per full session attended ", Start: "2025-02-06T09:00:25Z", End: "2025-02-06T10:30:25Z", Button: "Register now", URL: "https://p.westconcomstor.com/emea_zsc_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 20:47:03", Modified: "2025-01-13 20:47:03", vendors: "163,180", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8363", Author: "523", Title: "AI in Cybersecurity", Description: "Dive into the transformative role of Artificial Intelligence in modern cybersecurity and explore how AI can accelerate and enhance DNS-based threat detection capabilities. Earn 20 Tech Xpert points when you attend!", Start: "2025-02-05T09:30:03Z", End: "2025-02-05T10:45:03Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_eef_tech-xpert-sessions.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 14:52:56", Modified: "2025-01-13 14:52:56", vendors: "187,163", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,5,32,33,35", }, { id: "8235", Author: "481", Title: "Action Plans: Reduce Time To Fix Cloud Security Risks", Description: "Join this short track series of live webinars featuring sales and technical contents. You will discover how the biggest innovations in Prisma Cloud can help secure customers\\' Cloud and AI transformation.", Start: "2025-02-04T13:00:03Z", End: "2025-02-04T14:00:03Z", Button: "", URL: "https://register.paloaltonetworks.com/actionplansreducetimetofixclou", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-24 07:54:19", Modified: "2024-10-24 07:54:19", vendors: "15", countries: "16", }, { id: "8266", Author: "303", Title: "Stratus SkillBoost: ztC Endurance Deep Dive", Description: "Join our Westcon Stratus SkillBoost session, detailed insights into ztC Endurance\u2019s resilience and management capabilities. As a Tech Xpert member, you will get 15 TXP points for attending this session.", Start: "2025-02-04T10:00:03Z", End: "2025-02-04T11:30:03Z", Button: "", URL: "https://p.westconcomstor.com/emea_str_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-11-04 22:38:06", Modified: "2024-11-04 22:45:54", vendors: "192,163", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8368", Author: "639", Title: "Zscaler Get Skilled in 4 - Session 2", Description: "Zscaler Zero Trust Networking Solution (Virtual)\\nZscaler Cyber Threat Protection Solution \\n\\nYou will earn 20 TX points per full session attended ", Start: "2025-01-31T09:00:05Z", End: "2025-01-31T10:15:05Z", Button: "Register now", URL: "https://p.westconcomstor.com/emea_zsc_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 20:41:22", Modified: "2025-01-13 20:41:22", vendors: "163,180", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8369", Author: "639", Title: "Zscaler Get Skilled in 4 - Session 2", Description: "Zscaler Zero Trust Networking Solution (Virtual)\\nZscaler Cyber Threat Protection Solution \\n\\nYou will earn 20 TX points per full session attended ", Start: "2025-01-31T09:00:05Z", End: "2025-01-31T10:15:05Z", Button: "Register now", URL: "https://p.westconcomstor.com/emea_zsc_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 20:41:23", Modified: "2025-01-13 20:41:23", vendors: null, countries: null, }, { id: "8088", Author: "627", Title: "Accelerate through Cisco", Description: "We\\'ll cover how to get to Select with Cisco, give you an overview of Specialisations and how to make selling Cisco profitable.", Start: "2025-01-30T10:00:31Z", End: "2025-01-30T10:45:31Z", Button: "Register here", URL: "https://comstoremea.webex.com/weblink/register/ra68dec7c5e72e8aa014aecef96bbdf48", Location: "", Location_URL: "", Virtual: "1", Created: "2024-09-17 09:07:24", Modified: "2024-09-17 09:07:52", vendors: "7,143,190", countries: "35", }, { id: "8257", Author: "370", Title: "Cisco Secure Connect Deep Dive", Description: "Verdiep je kennis op Cisco Secure Connect met deze exclusieve training. Ontdek hoe deze unified SASE oplossing jouw digitale business kan verbeteren door gebruikers, apparaten en applicaties veilig en naadloos met elkaar te verbinden, waar je ook bent.", Start: "2025-01-30T09:00:49Z", End: "2025-01-30T14:00:49Z", Button: "Registreer je hier!", URL: "https://p.westconcomstor.com/nl_cis_security-360-trainingen.html", Location: "", Location_URL: "", Virtual: "0", Created: "2024-11-01 09:18:34", Modified: "2024-11-01 09:18:34", vendors: "7,8", countries: "23", }, { id: "8366", Author: "639", Title: "Zscaler Get Skilled in 4 - Session 1", Description: "Zscaler Zero Trust Cloud Architecture (Virtual)\\nTraffic Forwarding and Authentication\\n\\nYou will earn 20 TX points per full session attended ", Start: "2025-01-30T09:00:22Z", End: "2025-01-30T11:15:22Z", Button: "Register now", URL: "https://p.westconcomstor.com/emea_zsc_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 20:35:47", Modified: "2025-01-13 20:37:19", vendors: "163,180", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8367", Author: "639", Title: "Zscaler Get Skilled in 4 - Session 1", Description: "Zscaler Zero Trust Cloud Architecture (Virtual)\\n\\nYou will earn 20 TX points per full session attended ", Start: "2025-01-30T09:00:22Z", End: "2025-01-30T11:15:22Z", Button: "Register now", URL: "https://p.westconcomstor.com/emea_zsc_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 20:35:47", Modified: "2025-01-13 20:35:47", vendors: null, countries: null, }, { id: "8349", Author: "303", Title: "Introduction to Nokia Network Infrastructure Portfolio", Description: "Together, Westcon-Comstor and Nokia provide the building blocks needed to unleash the full potential of network infrastructure. Join our webinar to learn more about the Network and Infrastructure portfolio of Nokia.", Start: "2025-01-29T10:00:20Z", End: "2025-01-29T11:00:20Z", Button: "", URL: "https://p.westconcomstor.com/emea_nok_network-infrastructure-introduction-webinar.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-20 12:58:02", Modified: "2024-12-20 12:58:02", vendors: "73", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8353", Author: "523", Title: "Prisma Cloud AWS Xperience 3D Lab Showcase", Description: "Join us as we showcase our Prisma Cloud AWS Xperience 3D Lab, so you know exactly how to navigate the environment and use it for your own enablement and customer demos. Earn 15 Tech Xpert points when you attend this session!", Start: "2025-01-29T09:30:17Z", End: "2025-01-29T10:15:17Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-24 09:05:03", Modified: "2024-12-24 09:05:03", vendors: "15,163", countries: "9,10,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8345", Author: "559", Title: "Fuel your pipeline with Q2 demand generation campaigns ", Description: "Clare Buerge (EMEA Channel Marketing Manager) & Lora Neidhardt Maksic (EMEA SMB Marketing Lead) will take you through the HPE Aruba Networking campaigns available for you to run in Q2 (Feb-April). ", Start: "2025-01-29T09:00:43Z", End: "2025-01-29T09:30:43Z", Button: "Register", URL: "https://arubanetworks.zoom.us/webinar/register/WN_OKXNAR5nR5WxXXPYpF9FXg#/registration", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-17 14:40:02", Modified: "2024-12-17 14:40:02", vendors: "137", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "8333", Author: "602", Title: "Dream Team Stammtisch: Extreme Networks & Palo Alto Networks", Description: "Wir laden Sie herzlich ein, mit uns in lockerer Atmosph\u00e4re \u00fcber die neuesten Trends in IT Networking und Cyber Security zu sprechen. Extreme BOB Kit live erleben und testen \u2013 Extreme Fabric Connect inkl. Palo Alto Firewall Integration.", Start: "2025-01-28T16:30:56Z", End: "2025-01-28T21:00:56Z", Button: "Hier anmelden", URL: "https://p.westconcomstor.com/DE_EXT_StammtischJan25.html", Location: "Leipzig", Location_URL: "", Virtual: "0", Created: "2024-12-09 08:52:14", Modified: "2024-12-09 08:52:14", vendors: "9,15", countries: "16", }, { id: "8365", Author: "621", Title: "Webinar CrowdStrike Cloud Security", Description: "Descubra como a CrowdStrike e a Westcon podem ajudar a sua organiza\u00e7\u00e3o a proteger os seus workloads, aplica\u00e7\u00f5es, e c\u00f3digo na componente de Cloud.\\n\\nSess\u00e3o Comunidade TechXpert: +15 TXP", Start: "2025-01-28T10:00:47Z", End: "2025-01-28T10:30:47Z", Button: "Registe-se j\u00e1!", URL: "https://westconemea.webex.com/weblink/register/rf98971252bd433a24c915a1605082191", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-13 17:31:42", Modified: "2025-01-13 17:31:42", vendors: "167,163", countries: "28", }, { id: "8341", Author: "657", Title: "F5 Bootcamp", Description: "\\nEntdecken Sie Multi-Cloud-L\u00f6sungen mit F5 Distributed Cloud (F5 XC): Effizient, sicher und flexibel. Spannende Sessions zu Grundlagen, Sicherheit, DNS-Management und Multi-Cloud-Konnektivit\u00e4t, erg\u00e4nzt durch interaktive Labs zur direkten Anwendung.", Start: "2025-01-28T07:00:11Z", End: "2025-01-28T14:00:11Z", Button: "HIER ANMELDEN!", URL: "https://p.westconcomstor.com/at_f5_bootcamp_jan25.html", Location: "Westcon Office Austria", Location_URL: "", Virtual: "0", Created: "2024-12-13 11:03:56", Modified: "2024-12-13 11:03:56", vendors: "10", countries: "9", }, { id: "8121", Author: "481", Title: "Unlocking Synergy: XSOAR and XSIAM in Cybersecurity", Description: "Join this webinar to discover how the integration of Cortex XSIAM into an existing Cortex XSOAR environment can unlock new possibilities and further propel your automation and orchestration efforts. ", Start: "2025-01-23T13:00:24Z", End: "2025-01-23T14:00:24Z", Button: "Details & Anmeldung", URL: "https://register.paloaltonetworks.com/xsoar-xsiam-session9", Location: "", Location_URL: "", Virtual: "1", Created: "2024-09-30 12:18:59", Modified: "2024-09-30 12:18:59", vendors: "15", countries: "16", }, { id: "8338", Author: "657", Title: "Prisma Access Browser Workshop", Description: "Wir freuen uns, Sie zu einem besonderen Vor-Ort-Event einzuladen: dem Prisma Access Browser (PAB) Kompakt-Workshop, kombiniert mit einem entspannten Networking-Grill-Kurs!", Start: "2025-01-23T12:00:29Z", End: "2025-01-23T18:30:29Z", Button: "Jetzt anmelden", URL: "https://p.westconcomstor.com/at_pan_pan-pab-workshop.html", Location: "Grill Heaven, SCS", Location_URL: "", Virtual: "0", Created: "2024-12-13 10:45:11", Modified: "2024-12-13 10:45:33", vendors: "15", countries: "9", }, { id: "8313", Author: "303", Title: "Nokia SkillBoost: Network Infrastructure Portfolio", Description: "Join the Nokia Network Infrastructure Portfolio update and learn how to meet customer requirements with trusted network performance and open network architectures. This is part of Nokia SkillBoost sessions for Tech Xpert.", Start: "2025-01-23T09:00:37Z", End: "2025-01-23T10:30:37Z", Button: "", URL: "https://p.westconcomstor.com/emea_nok_skillboost.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-02 14:59:20", Modified: "2024-12-02 14:59:20", vendors: "73,163", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "8340", Author: "657", Title: "Extreme Accreditation Workshop", Description: "Dieser Workshop bietet Ihnen die M\u00f6glichkeit, Ihre Verkaufsf\u00e4higkeiten zu optimieren und sich mit den neuesten Produkten und L\u00f6sungen vertraut zu machen.", Start: "2025-01-23T07:00:02Z", End: "2025-01-23T11:00:02Z", Button: "GLEICH ANMELDEN!", URL: "https://p.westconcomstor.com/at_ext_accreditation-workshop.html", Location: "Westcon Office Austria", Location_URL: "", Virtual: "0", Created: "2024-12-13 10:59:43", Modified: "2024-12-13 11:00:17", vendors: "9", countries: "9", }, { id: "8361", Author: "644", Title: "Cisco Collaboration, Devices and Webex Calling [FY25Q2]", Description: "", Start: "2025-01-23T06:00:29Z", End: "2025-01-23T08:00:29Z", Button: "Register for the Eve", URL: "", Location: "Comstor Office - Leap Center", Location_URL: "", Virtual: "0", Created: "2025-01-08 04:31:49", Modified: "2025-01-08 04:31:49", vendors: "7,143,163", countries: "29", }, { id: "8348", Author: "602", Title: "2025 Networking Technology Trends", Description: "\u2022 AI-Driven Network Management and Operations\\n\u2022 Wi-Fi 7 Wireless Convergence\\n\u2022 Sustainable Networking and Green ESG\\n\u2022 Edge-as-a-Service\\n\u2022 Post AI User Engagement", Start: "2025-01-22T15:00:40Z", End: "2025-01-22T16:00:40Z", Button: "Register Here", URL: "https://events.commscope.com/commscope-virtual/2025-Networking-Technology-Trends-c14671f7e7ff7ce347f0c76c", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-17 15:23:11", Modified: "2024-12-17 15:23:11", vendors: "108", countries: "9,10,12,13,14,15,16,17,20,23,37,25,27,28,31,32,33,35", }, { id: "8360", Author: "627", Title: "Marketing 101: Harness the power of Cisco Marketing Velocity", Description: "In this 101 session, Comstor\\'s Partner Marketing Manager UKI and Cisco will be doing a deep dive into the Cisco Marketing Velocity platforms updates.", Start: "2025-01-22T15:00:22Z", End: "2025-01-22T16:00:22Z", Button: "Register here", URL: "https://comstoremea.webex.com/weblink/register/r3d6f1328cbfdad6b432b8187a1ad1f39", Location: "", Location_URL: "", Virtual: "1", Created: "2025-01-07 14:25:32", Modified: "2025-01-07 14:26:11", vendors: "7,143", countries: "35", }, { id: "8352", Author: "523", Title: "Prisma Cloud AWS Xplore 3D Lab Showcase", Description: "Join us as we showcase our Prisma Cloud AWS Xplore 3D Lab, so you know exactly how to navigate the environment and use it for your own enablement and customer demos. Earn 15 Tech Xpert points when you attend this session!", Start: "2025-01-22T09:30:56Z", End: "2025-01-22T10:15:56Z", Button: "REGISTER NOW", URL: "https://p.westconcomstor.com/emea_pan_ride-the-nextwave.html", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-24 09:04:18", Modified: "2024-12-24 09:04:18", vendors: "15,163", countries: "9,10,12,13,14,15,16,17,20,22,37,25,27,28,31,5,32,33,35", }, { id: "8344", Author: "559", Title: "AI for Networking in Wireless ", Description: "As more devices and things are connecting to Wireless,keeping up with the volume, security and network maintenance becomes more challenging.By leveraging the power of AI we can help simplify deployment, client connectivity, performance,insights, security.", Start: "2025-01-22T09:00:40Z", End: "2025-01-22T09:30:40Z", Button: "Register", URL: "https://arubanetworks.zoom.us/webinar/register/WN_C1wZ2PY_SSKREtYSBqVhGA#/registration", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-17 14:38:41", Modified: "2024-12-17 14:38:41", vendors: "137", countries: "9,10,12,13,14,15,16,17,20,22,23,37,25,27,28,31,5,32,33,35", }, { id: "7761", Author: "627", Title: "Cybersecurity 360 Labs - Cisco Firepower (Advanced)", Description: "Get engineers up to speed on Cisco Firepower protection. Use the latest NGFW version (7,4,x) together with Cisco ISE policy &amp;Umbrella security solutions enabling companies to maximize their business security.", Start: "2025-01-21T13:00:07Z", End: "2025-01-21T14:00:07Z", Button: "Register here", URL: "https://comstoremea.webex.com/weblink/register/r191258199fee6362386c160e8246ff88", Location: "", Location_URL: "", Virtual: "1", Created: "2024-05-24 15:52:26", Modified: "2024-11-12 09:52:46", vendors: "7,143", countries: "35", }, { id: "8234", Author: "481", Title: "Prisma Cloud Security Assessment for Your Customers", Description: "Join this short track series of live webinars featuring sales and technical contents. You will discover how the biggest innovations in Prisma Cloud can help secure customers\\' Cloud and AI transformation.", Start: "2025-01-21T13:00:02Z", End: "2025-01-21T14:00:02Z", Button: "", URL: "https://register.paloaltonetworks.com/cloudsecurityassessmentforyour", Location: "", Location_URL: "", Virtual: "1", Created: "2024-10-24 07:52:55", Modified: "2024-10-24 07:52:55", vendors: "15", countries: "16", }, { id: "8334", Author: "6", Title: "Future Proofing the Workplace with Wi-Fi 7", Description: "Breaking News: What\u2019s new and why it matters. Wi-Fi Evolution: Positioning Wi-Fi 7 and understanding its relationship with Wi-Fi 6 and 6E. Unlocking Opportunities: Discover the market potential and identify your unique opportunities. And more..", Start: "2025-01-21T10:00:06Z", End: "2025-01-21T11:00:06Z", Button: "REGISTER ", URL: "https://comstorbe.webex.com/webappng/sites/comstorbe/webinar/webinarSeries/register/34c25901dd5545949efc105e66456a98", Location: "", Location_URL: "", Virtual: "1", Created: "2024-12-11 14:08:45", Modified: "2024-12-11 14:08:45", vendors: "7,8", countries: "10,13,14,15,16,22,23,37,25,28,31,5,32,35", }, { id: "7757", Author: "627", Title: "Cybersecurity 360 Training - Cisco Firepower (Advanced)", Description: "Get engineers up to speed on Cisco Firepower protection. Use the latest NGFW version (7,4,x) together with Cisco ISE policy &amp;Umbrella security solutions enabling companies to maximize their business security.", Start: "2025-01-21T10:00:04Z", End: "2025-01-21T11:00:04Z", Button: "Register here", URL: "https://comstoremea.webex.com/weblink/register/rbcb397b6241d7fc1aa8c4748a2dff507", Location: "", Location_URL: "", Virtual: "1", Created: "2024-05-24 15:46:26", Modified: "2024-11-12 09:48:12", vendors: "7,143", countries: "35", }, ]`; /** * Helper function to return a response and exit. * * @param mixed $data * @param array|null $error * @param int $httpCode */ function respond($data, $error = null, $httpCode = 200) { global $mysqli; if (isset($mysqli) && $mysqli) { $mysqli->close(); } http_response_code($httpCode); echo json_encode([ 'data' => $data, 'error' => $error ]); exit; } /** * Validates and sanitizes a field in the event input. * * @param array $input * @param string $key * @param bool $required * @param mixed $default * @return string|mixed */ function validateInput($input, $key, $required = true, $default = null) { if (!isset($input[$key])) { if ($required) { respond(null, ['code' => 400, 'message' => "$key is missing"]); } return $default; } // Basic sanitization return htmlspecialchars(trim($input[$key])); } // Get the entire request body as an array of events $eventsArray = json_decode($mockEvents, true); // Validate that we received an array if (!is_array($eventsArray)) { respond(null, ['code' => 400, 'message' => 'Invalid JSON payload or not an array of events']); } // Start transaction $mysqli->begin_transaction(); $newEventIds = []; try { foreach ($eventsArray as $index => $input) { // Validate event data (assuming no 'id' field is used for creation) $Author = validateInput($input, 'Author', true); $Title = validateInput($input, 'Title', true); $Description = validateInput($input, 'Description', true); $Start = validateInput($input, 'Start', true); $End = validateInput($input, 'End', true); $Button = validateInput($input, 'Button', false, ""); $URL = validateInput($input, 'URL', true); $Location = validateInput($input, 'Location', true); $Location_URL = validateInput($input, 'Location_URL', true); $Virtual = validateInput($input, 'Virtual', true); $MultipleDates = validateInput($input, 'Multiple_dates', false, 0); $Recurring = validateInput($input, 'Recurring', false, 0); $OnDemand = validateInput($input, 'On_Demand', false, 0); // Convert dates to MySQL format $Start = date('Y-m-d H:i:s', strtotime($Start)); $End = date('Y-m-d H:i:s', strtotime($End)); // Validate relationships $vendorIDs = $input['vendors'] ?? []; $countryIDs = $input['countries'] ?? []; // 1) Insert into `Events` $stmt = $mysqli->prepare(" INSERT INTO `Events` (`Author`, `Title`, `Description`, `Start`, `End`, `Button`, `URL`, `Location`, `Location_URL`, `Virtual`, `Multiple_dates`, `Recurring`, `On_Demand`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "); if (!$stmt) { throw new Exception($mysqli->error, 500); } $stmt->bind_param( "isssssssssiii", $Author, $Title, $Description, $Start, $End, $Button, $URL, $Location, $Location_URL, $Virtual, $MultipleDates, $Recurring, $OnDemand ); if (!$stmt->execute()) { throw new Exception($stmt->error, 500); } $newEventId = $stmt->insert_id; $stmt->close(); // 2) Insert into Events_Vendors_Tags if (!empty($vendorIDs)) { $stmt = $mysqli->prepare("INSERT INTO Events_Vendors_Tags (event_id, vendor_id) VALUES (?, ?)"); if (!$stmt) { throw new Exception($mysqli->error, 500); } foreach ($vendorIDs as $vendorID) { $stmt->bind_param("ii", $newEventId, $vendorID); if (!$stmt->execute()) { throw new Exception($stmt->error, 500); } } $stmt->close(); } // 3) Insert into Events_Countries_Tags if (!empty($countryIDs)) { $stmt = $mysqli->prepare("INSERT INTO Events_Countries_Tags (event_id, country_id) VALUES (?, ?)"); if (!$stmt) { throw new Exception($mysqli->error, 500); } foreach ($countryIDs as $countryID) { $stmt->bind_param("ii", $newEventId, $countryID); if (!$stmt->execute()) { throw new Exception($stmt->error, 500); } } $stmt->close(); } // Keep track of the newly inserted event ID $newEventIds[] = $newEventId; } // Commit if everything is OK $mysqli->commit(); // Return an array of created IDs respond($newEventIds, null, 200); } catch (Exception $e) { // Something went wrong, rollback all $mysqli->rollback(); respond( null, [ 'code' => $e->getCode() ?: 500, 'message' => $e->getMessage() ], 500 ); } ?>
Show:  
Copy Clear