png3
1
//i want to place each table above the other not to display on whole screen, apart from this i want to display the current date in the top of every block of tables
<!DOCTYPE html>
<html>
<head>
</head>
<style>
//css about table
table.week_view_table{
width:300px;
border-spacing:0px;
border: 0px solid #008CBA;
border-radius: 10px;
padding:5px;
float:left;
}
table.week_view_table th{
background:#e7e7e7;/* Red */
color:#000;
font-size:14px;
padding:5px;
text-align:right;
border-radius: 5px 0px 0px 5px;
font-weight:normal;
border: 1px solid #008CBA;
}
table.week_view_table tr:nth-child(even) {background-color: #f2f2f2}
table.week_view_table tr:hover{
background-color:#e7e7e7;
color: #000000;
}
table.week_view_table td{
font-size:13px;
color:#4e4e4e;
padding:5px;
}
table.week_view_table td:hover{
color: #000000;
}
</style>
<body>
<?php
//connect settings
$servername = "sth.gr";
$username = "sth";
$password = "sth123";
$database = "sth";
// Create connection
$con = mysqli_connect($servername, $username, $password, $database);
// Check connection
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
?>
<?php
//here is the variable of the date
$today=date("Y-m-d");
//query
$sql = "
SELECT FLINES.FLINES,LMAST.NAME,FDOC.FDOC,FLINES.COMMENTS AS FLCOMMENTS,FLINES.QTY1,SUBSTRING(FDOC.TRNDATE,1,10) AS TRNDATE,FLINES.SE1_START,TIMESTAMPDIFF(MINUTE,SE1_START,SE1_END) AS DIFERENCE
FROM FLINES
INNER JOIN FDOC ON FDOC.FDOC=FLINES.FDOC
INNER JOIN LMAST ON LMAST.LMAST=FDOC.LMAST
INNER JOIN SMAST ON SMAST.SMAST=FLINES.SMAST
WHERE TRNDATE >= '$today' AND SMAST.U_SE1='true' AND FLINES.SE1_END IS NULL
ORDER BY TRNDATE,FDOC,FLINES
";
//query in a variable to fetch
$smt=mysqli_query($con,$sql);
//fetch the database
while($row = mysqli_fetch_array($smt)) {
if ($temp_FDOC!=$row[FDOC]){ ?>
<div style="padding: 15px 0px 5px 5px;">
<table class="week_view_table" cellspacing="5" >
<tr>
<th colspan="10">
//header
<?php echo $row[NAME];
//echo'<br>';
?>
</th>
</tr>
<tr>
<td>Υλ.</td>
<td>Προϊόν</td>
<td>Ποσ.</td>
<td>Στάδιο</td>
</tr>
<?php $j=0; } ?>
<tr onclick="document.getElementById('<? echo $row[FLINES];?>').style.display='block'">
//contents
<td><?php echo $j=$j+1; ?></td>
<td><?php echo $row[FLCOMMENTS]; ?></td>
<td><?php echo $row[QTY1]; ?></td>
<td>
<?php
//buttons
if($row[SE1_START]==NULL) {
echo '<button name="flines_id_start" value="<? echo $row[FLINES];?>" type="submit">ΞΕΚΙΝΑΩ</button>';
//echo'<br>';
}
else {
echo '<button name="flines_id_end" value="<? echo $row[FLINES];?>" type="submit">ΕΤΟΙΜΟ</button>';
echo '<button name="flines_id_again" value="<? echo $row[FLINES];?>" type="submit">ΕΠΑΝΕΚΚΗΝΙΣΗ</button>';
//echo'<br>';
}
?>
</td>
</tr>
//temp
<?php
$temp_FDOC=$row[FDOC];
};
?>
</table>
</div>
//for the memory
<?php
mysqli_free_result($con);
?>
</body>
</html>