This repository has been archived by the owner on Sep 5, 2021. It is now read-only.
forked from avs-code/PREM-Podium-race-E-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrivers.php
58 lines (55 loc) · 1.61 KB
/
drivers.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<? if(!defined("CONFIG")) exit(); ?>
<? if(!isset($login)) { show_error("You do not have administrator rights\n"); return; } ?>
<?
if(isset($_GET['filter'])) {
$filter = $_GET['filter'];
$query_where = "WHERE d.name LIKE '%$filter%'";
}
require_once("functions.php"); // import mysql function
$link = mysqlconnect(); // call mysql function to get the link to the database
$query = "SELECT d.*, COUNT(td.id) teamcount FROM driver d LEFT JOIN team_driver td ON (td.driver = d.id) $query_where GROUP BY d.id ORDER BY name ASC";
$result = mysqli_query($link,$query);
if(!$result) {
show_error("MySQL error: " . mysqli_error($link));
return;
}
?>
<h1>Drivers</h1>
<div align="right">
<form action="." method="GET">
<input type="hidden" name="page" value="drivers">
<input type="text" class="search" name="filter" value="<?=$_GET['filter']?>">
</form>
</div>
<a href=".?page=driver_add">Add driver</a>
<?
if(mysqli_num_rows($result) == 0) {
show_msg("No drivers found\n");
return;
}
?>
<div class="w3-container">
<table class="w3-table-all">
<tr class="w3-dark-grey">
<td> </td>
<td>Name</td>
<td align="center">Teams</td>
</tr>
<?
#$style = "odd";
while($item = mysqli_fetch_array($result)) {
?>
<!--<tr class="#<?=$style?>">-->
<tr class="w3-hover-green">
<td>
<a href=".?page=driver_chg&id=<?=$item['id']?>"><img src="images/edit16.png" alt="chg"></a>
<a href=".?page=driver_rem&id=<?=$item['id']?>"><img src="images/delete16.png" alt="rem"></a>
</td>
<td><?=$item['name']?></td>
<td width="40" align="center"><?=$item['teamcount']?></td>
</tr>
<?
#old style.css $style = $style == "odd" ? "even" : "odd";
}
?>
</table>