-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadData.php
More file actions
22 lines (20 loc) · 819 Bytes
/
loadData.php
File metadata and controls
22 lines (20 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$anc = $_GET["anc"];
$mysqli = new mysqli('localhost', 'root', '', 'tt');
if ( $mysqli->connect_error ) {
die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
}
$res=$mysqli->query('SELECT Messages.*, Users.FirstName, Users.LastName FROM Messages INNER JOIN TreePath ON Messages.CommentID=TreePath.Descendant INNER JOIN Users ON Users.ID=Messages.userID WHERE TreePath.Ancestor='.$anc.' AND TreePath.Descendant!='.$anc.' AND TreePath.Depth=1 AND Users.ID=Messages.userID ORDER BY Messages.Date DESC');
$d = $res->fetch_all();
for( $i = 0; $i < count($d); $i++ )
{
$z = NULL;
$z = $mysqli->query('SELECT Count(*) FROM TreePath WHERE Ancestor='.$d[$i][0]);
$count = $z->fetch_row();
if( $count[0] == 1 )
$d[$i][] = false;
else
$d[$i][] = true;
}
echo json_encode( $d );
?>