-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetstats.php
35 lines (24 loc) · 855 Bytes
/
getstats.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
<?php
session_start();
$con = mysqli_connect('localhost', 'root','') or die (mysqli_conect_errno());
mysqli_select_db($con, 'web');
$username = $_SESSION['username'];
$q = "SELECT recordSum, lastUpload FROM `statistics` WHERE name = '$username';";
$res = mysqli_query($con, $q);
$fetchData = mysqli_fetch_all($res, MYSQLI_ASSOC);
$createTable = '<table>';
$createTable .= '<tr>';
$createTable .= '<th>Number of records</th>';
$createTable .= '<th>Date of last upload</th>';
foreach($fetchData as $userData)
{
$createTable .= '<tr>';
$createTable .= '<td>'.$userData['recordSum'].'</td>';
$createTable .= '<td>'.$userData['lastUpload'].'</td>';
$createTable .= '</tr>';
}
$createTable .= '</table>';
echo $createTable;
//mysqli_free_result($res);
mysqli_close($con);
?>