Is there anyway i can link a session to a particular table within my database, well i think this is how i need to do it.
I have different tables which hold information for different shifts.
The user selects the Site from one page, then selects the shift from another page, and then goes to the login page, so depending on the user logging in, i want it to check the login details are correct and then depending on the Shift selected previously, display that information in my page.
i was origionally using this, once it had checked login details:
<?php
if($_SESSION['Shift']=='T5 Week 3 Shift 3'){
session_start();
$_SESSION["username"] = $username;
header("location:layout_t5.php");
$_SESSION["Camera_Operator"] = $Camera_Operator;
$_SESSION["Shift"] = $Shift;
$_SESSION["Site"] = $Site;
}
?>
which works fine but i really want to use a generic layout page,so i dont have to write the above code everytime and have a new layout page for each shift, so depending on the Shift selected display that table information.
code on my layout_t5 page to display certain information as buttons:
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<?php
$query_Recordset21 = "SELECT Distinct Location FROM t5_week3_shift3";
$Recordset21 = mysql_query($query_Recordset21, $Database_Connection) or die(mysql_error());
while ($row21 = mysql_fetch_assoc($Recordset21)) {
$location = $row21['Location'];
?>
<li class="TabbedPanelsTab" tabindex="<?php echo $i++; ?>"><?php echo $location; ?></li>
<?php } ?>
</ul>
<div class="TabbedPanelsContentGroup">
<?php
$query_Recordset21 = "SELECT Distinct Location FROM t5_week3_shift3";
$Recordset21 = mysql_query($query_Recordset21, $Database_Connection) or die(mysql_error());
while ($row21 = mysql_fetch_assoc($Recordset21)) {
$location = $row21['Location'];
?>
<div class="TabbedPanelsContent">
<?php
$query_Recordset22 = 'SELECT Distinct Asset_ID FROM t5_week3_shift3 where Location="'.$location.'"';
$Recordset22 = mysql_query($query_Recordset22, $Database_Connection) or die(mysql_error());
while ($row = mysql_fetch_assoc($Recordset22)) {
$row_id = $row['Asset_ID'];
$query_Recordset23 = 'SELECT date(`Date`) as thisdate,curdate(),(date(`Date`)=curdate()) AS isToday FROM conveyor_number where ConveyorNumber="'.$row_id.'" order by `Date` DESC';
$Recordset23 = mysql_query($query_Recordset23, $Database_Connection) or die(mysql_error());
$row2 = mysql_fetch_assoc($Recordset23);
if(empty($searchdate)) {
$isred = $row2['isToday'];
} elseif($searchdate == $row2['thisdate']) {
$isred = 1;
} else {
$isred = 0;
}
if($isred) {
$action = "history3.php";
} else {
$action = "new.php";
}
?>