The PHP Event Calendar with MySQL Database is a web-based system that is very helpful for remembering impending meetings, deadlines, and milestones.
Further, They can also help in the visualization of your schedule and serve as a reminder of special events such as holidays and vacations.
How to add event in Google Calendar using php?
Creating an event using Google Calendar API consists of 5 steps:
- Register a Google Application and enable Calendar API.
- In your web application, request user for authorization of the Google Application.
- Get the user’s timezone.
- Use the primary calendar of the user. Or else get the list of his calendars and let the user choose.
- Create an event on this calendar.
How To Create PHP Event Calendar With MySQL Database?
Users can add, browse, and delete day events using the event calendar. To show calendars on web pages, we use the FullCalendar free library.
This FullCalendar offers drag-and-drop events as well as interactive elements.
It also provides calendar views for the month, week, and day.
To display the calendar, simply include the dependent files on the page.
- Step 1: Create a file to display the calendar.
Create an index.php file and include the required JS and CSS files for FullCalendar in it. This FullCalendar plugin has a variety of layouts.
<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <link href='fullcalendar.min.css' rel='stylesheet' /> <link href='fullcalendar.print.min.css' rel='stylesheet' media='print' /> <script src='lib/moment.min.js'></script> <script src='lib/jquery.min.js'></script> <script src='fullcalendar.min.js'></script> <script> $(document).ready(function () { var calendar = $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,basicWeek,basicDay' }, navLinks: true, // can click day/week names to navigate views editable: true, eventLimit: true, events: "all_events.php", displayEventTime: false, eventRender: function (event, element, view) { if (event.allDay === 'true') { event.allDay = true; } else { event.allDay = false; } } }); }); </script> <style> body { margin: 40px 10px; padding: 0; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; font-size: 14px; } #calendar { max-width: 900px; margin: 0 auto; } </style> </head> <body> <div id='calendar'></div> </body> </html>
- Step 2: Create a MySQL Table to Save Dynamic Events.
Now, using the query below, construct a MySQL database table to save dynamic events. This database table will be queried for all existing events.
CREATE TABLE `table_events` ( `id` int(11) NOT NULL, `title` varchar(255) COLLATE utf8_bin NOT NULL, `start` datetime NOT NULL, `end` datetime DEFAULT NULL, `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=Active, 0=Block' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
- Step 3: Create a Database Connection.
Now you’ll need to build a database connection to run all of the events functionality. To connect to MySQL, create a database.php file.
<?php $conn = mysqli_connect("localhost","root","username","password") ; if (!$conn) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } ?>
- Step 4: Adding an Event on Calendar.
On the calendar callback response, the following code is used to put event data into a database table.
<?php require "database.php"; $title = $_POST['title']; $start = $_POST['start']; $end = $_POST['end']; $sqlInsert = "INSERT INTO table_events (title,start,end) VALUES ('".$title."','".$start."','".$end ."')"; $result = mysqli_query($conn, $sqlInsert); if (! $result) { $result = mysqli_error($conn); } ?>
- Step 5: Show all events in the calendar.
We’ll use PHP code to get an array of all events data from a MySQL database table. Now, in JSON format, return the array contents.
<?php require "database.php"; $json = array(); $sqlQuery = "SELECT * FROM table_events ORDER BY id"; $result = mysqli_query($conn, $sqlQuery); $alldata = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($alldata, $row); } mysqli_free_result($result); mysqli_close($conn); echo json_encode($alldata); ?>
Project Details and Technology
Project Name: | PHP Event Calendar With MySQL Database Free Download |
Abstract | A PHP Event Calendar is a design pattern that allows the user to select a date. |
Language/s Used: | PHP Web Framework |
PHP version (Recommended): | 5.6.3 |
Database: | MySQL |
Type: | Website, Web Application |
Developer: | Source Code Hero |
Updates: | 0 |
Major Functionalities / Features Of The Project
- Calendar Event
- Manage Event Booking
- Manage Users
- Login System
- Manage Holidays
Steps On How To Run PHP Event Calendar With MySQL Database
Time needed: 5 minutes
These are the steps on how to run PHP Event Calendar With MySQL Database Free Download.
- Download Source Code
First, find the downloadable source code below and click to start downloading the source code file.
- Extract File
Next, after finished to download the file, go to file location and right click the file and click extract.
- Copy Project Folder
Next, copy the project folder and paste it to C:\xampp\htdocs.
- Open Xampp
Next, open xampp and start the apache and mysql.
- Create Database
Next, click any browser and type to the URL localhost/phpmyadmin and create database.
- Import Database
Next, click the created database and click import to the right tab and click choose file and import the sql file inside the download folder.
- Execute Project
Final, type to the URL localhost/event_management
Downloadable Source Code Here!
Anyway, if you want to level up your programming knowledge, especially PHP, try this new article I’ve made for you Best PHP Projects With Source Code Free Download.
Summary
As a result, this System is a basic project for all beginning and intermediate PHP users who want to broaden their understanding of PHP web applications.
Finally, the entire PHP project with open-source code is an absolute project and a valuable way for users to understand and explore more about it.
Related Articles
Inquiries
If you have any questions or suggestions about the PHP Event Calendar With MySQL Database Free Download, please feel free to leave a comment below.
hello , how are you?
I am wael zieneddine and I am computer science student and need this thing for field reservation system project I had to graduated by it .
I really very grateful to find an event calendar with these characters in this website and this project so I download the source code and open it successfully on my pc, But there is one more thing I need is to make a register page to register users ,I try many codes and many ways to make like this page but nothing work please if you can make a register page (register.php) to add users from it and I am so thankful for you
my email : [email protected]
whatsapp : +961 76867649
feel happy to reply for me
Hi! I can’t download it. help pls!
Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in D:\CakePHP\htdocs\event-management\library\config.php:36 Stack trace: #0 D:\CakePHP\htdocs\event-management\index.php(2): require_once() #1 {main} thrown in D:\CakePHP\htdocs\event-management\library\config.php on line 36
If you are using PHP 8.0 or newer, that line get_magic_quotes_gpc() is depreciated. Just remove the if statement as it is not needed to function.
eveint calenders in insert date and add images to useing for calender