-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_participants.php
39 lines (28 loc) · 1012 Bytes
/
list_participants.php
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
<?php
//enable this when finished
//error_reporting(0);
session_start();
if (file_exists('config.php')) {
include('config.php');
}
else {
include('../../config.php');
}
$conn = mysql_connect($sqlHost, $sqlUser, $sqlPass) or die("Can't connect to host : " . mysql_error());
$db = mysql_select_db($sqlDatabase, $conn) or die("Can't database to database: " . mysql_error());
$error = "";
// [insert code here to check if owner of post is = userid of session]
$post_id= $_GET['post_id'];
$post_id = stripslashes($post_id);
$post_id = mysql_real_escape_string($post_id);
$sql = "SELECT A.Firstname FROM
(SELECT Firstname, User_ID FROM Account) as A INNER JOIN
(SELECT * FROM Participants WHERE Post_ID = ".$post_id.") as B ON A.User_ID = B.Participant_ID";
$table = mysql_query($sql, $conn) or die($sql . " : " . mysql_error());
$return_array = Array();
while($rec = mysql_fetch_assoc($table)) {
array_push($return_array, $rec);
}
echo json_encode($return_array);
mysql_close($conn);
?>