-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaddMeeting.php
More file actions
29 lines (27 loc) · 1.06 KB
/
addMeeting.php
File metadata and controls
29 lines (27 loc) · 1.06 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
<?php
include 'includes/session.php';
include 'includes/dbConnect.php';
if (isset($_POST['submit'])){
$name = mysqli_real_escape_string($connection, $_POST['name']);
$description = mysqli_real_escape_string($connection, $_POST['description']);
$query = "INSERT INTO meetings (name, description) VALUES ('".$name."', '".$description."')";
$result = mysqli_query($connection, $query);
if ($result){
$query = "SELECT * FROM meetings WHERE name='".$name."' ORDER BY meeting_id DESC LIMIT 1";
$result = mysqli_query($connection, $query);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$meeting_id = $row['meeting_id'];
$query = "INSERT INTO meeting_users (meeting_id, user_id) VALUES ('".$meeting_id."', '".$user_id."')";
$result = mysqli_query($connection, $query);
if ($result){
header("Location: dashboard.php");
}
else {
echo 'failed to insert to TABLE meeting_users, please contact the site administrator.';
}
}
else {
echo 'failed to insert to TABLE meetings, please contact the site administrator.';
}
}
?>