-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.php
More file actions
15 lines (13 loc) · 896 Bytes
/
query.php
File metadata and controls
15 lines (13 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
include_once 'config.php';
$sqlQuery = "select * from computer left join (select * from reserved where day like '$day')as res on computer.asset = res.asset where";
if (isset($blocksRequested[0])) $sqlQuery= $sqlQuery."(block1 < 1 and block1 not like 'charging' or block1 is null) and";
if (isset($blocksRequested[1])) $sqlQuery= $sqlQuery."(block2 < 1 and block2 not like 'charging' or block2 is null) and";
if (isset($blocksRequested[2])) $sqlQuery= $sqlQuery."(block3 < 1 and block3 not like 'charging' or block3 is null) and";
if (isset($blocksRequested[3])) $sqlQuery= $sqlQuery."(block4 < 1 and block3 not like 'charging' or block4 is null) and";
$sqlQuery= $sqlQuery." type = $type";
$sqlQuery=$sqlQuery." limit ".$computersRequested;
if ($debug) echo 'Query from sqlQuery is: '.$sqlQuery.'<br>';
$result = mysqli_query($mysqli, $sqlQuery);
$numQuery = mysqli_num_rows($result);
?>