-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfetch.php
More file actions
42 lines (33 loc) · 1.67 KB
/
fetch.php
File metadata and controls
42 lines (33 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// Include your database connection file (config.php)
include 'constant/config.php';
// Check if eventID is provided in the POST request
if(isset($_POST['eventID'])) {
// Sanitize the input to prevent SQL injection
$eventID = mysqli_real_escape_string($conn, $_POST['eventID']);
// Query to fetch event details from the database
$sql = "SELECT * FROM create_event WHERE eventID = '$eventID'";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) > 0) {
// Fetch event details
$row = mysqli_fetch_assoc($result);
// You can format the data as per your requirement
$eventDetails = '<div class="event-details">';
$eventDetails .= '<h2 style="color: blue; font-weight: bold;">' . $row['eventname'] . '</h2>';
$eventDetails .= '<p><strong>Start Date:</strong> ' . $row['start_date'] . '</p>';
$eventDetails .= '<p><strong>End Date:</strong> ' . $row['end_date'] . '</p>';
$eventDetails .= '<p><strong>Client Name:</strong> ' . $row['clientuserID'] . '</p>';
$eventDetails .= '<p><strong>Place:</strong> ' . $row['place_of_meeting'] . '</p>';
// Add more details as needed
$eventDetails .= '</div>';
// Return the event details as JSON response
echo json_encode(array('success' => true, 'eventDetails' => $eventDetails));
} else {
// If event is not found
echo json_encode(array('success' => false, 'message' => 'Event not found.'));
}
} else {
// If eventID is not provided in the request
echo json_encode(array('success' => false, 'message' => 'Event ID not provided.'));
}
?>