ngreenwood6 Posted December 9, 2008 Share Posted December 9, 2008 I have the following page: <?php session_start(); //include the variables include("../vars.php"); //check that the session is set if(!$_SESSION['logged_in']) { header("Location:not_logged.php"); } //connect to the server $conn = mysql_connect($host, $db_user, $db_pass); //select database mysql_select_db($db); //get the edit value $edit = $_GET['edit']; ?> <html> <title><?php echo $title; ?></title> <body> <table style="border:1px thin solid #000000; margin:0; width:800px;"> <tr> <td> <table> <tr> <td><?php include("navigation.php"); ?></td> <td style="border:1px thin solid #000000;"> <Center><b>Here is a list of users:</b></Center> <?php //make the query $query = "SELECT * FROM login"; //get the results $results = mysql_query($query); if($edit == "users") { echo "<table border='1'>"; echo "<tr>"; echo "<th>UserName</th>"; echo "<th>Name</th>"; echo "<th>Email</th>"; echo "<th>School 1</th>"; echo "<th>School 2</th>"; echo "<th>School 3</th>"; echo "<th>Membership</th>"; echo "<th>Options</th>"; echo "</tr>"; while($row = mysql_fetch_array($results)) { echo "<tr>"; echo "<td>" . $row['username'] . "</td>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['school_1'] . "</td>"; echo "<td>" . $row['school_2'] . "</td>"; echo "<td>" . $row['school_3'] . "</td>"; echo "<td>" . $row['membership'] . "</td>"; echo "<td><a href=\"edit_user.php?id=" . $row['id'] . "\">Edit</a> | <a href=\"delete_user.php?id=" . $row['id'] . "\">Delete</a></td>"; echo "</tr>"; } echo "</table>"; echo "<br>"; echo "<a href=\"add_user.php\">Add New User</a>"; } elseif($edit == "schools") { //make the query $query = "SELECT * FROM schools"; //get the results $results = mysql_query($query); echo "<table border='1'>"; echo "<tr>"; echo "<th>Schools</th>"; echo "<th>Tech</th>"; echo "</tr>"; while($row = mysql_fetch_array($results)) { //make the tech id variable $tech_id = $row['tech_id']; //make the tech query $tech_query = "SELECT * FROM login WHERE id = '$tech_id'"; //get the tech results $tech_results = mysql_query($tech_query); echo "<tr>"; echo "<td>" . $row['school'] . "</td>"; while($tech_row = mysql_fetch_array($tech_results)) { echo "<td>" . $tech_row['name'] . "</td>"; } echo "<td><a href=\"edit_school.php?id=" . $row['id'] . "\">Edit</a> | <a href=\"delete_school.php?id=" . $row['id'] . "\">Delete</a></td>"; echo "</tr>"; } echo "</table>"; echo "<br>"; echo "<a href=\"add_school.php\">Add New School</a>"; } ?> </td> </tr> </table> </td> </tr> </table> There are 2 ways to visit this page either editing users or schools. I have another page that shows incomplete work orders. When I view this page using the users editing and go back to the incomplete work page it displays fine but when I view this page editing the schools it no longer shows the incomplete work until I logout and log back in. Its almost like it is losing the session. I can post the other page if someone needs to see it. Link to comment https://forums.phpfreaks.com/topic/136201-solved-something-wrong-with-session/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.