jigsawsoul Posted January 24, 2010 Share Posted January 24, 2010 This code display a list of all my staff members from the database: <!-- Page Content --> <?php $result = "SELECT * FROM web_staff LEFT JOIN web_login ON web_staff.login_id=web_login.login_id WHERE userlevel = '2' ORDER BY firstname ASC"; $result = mysql_query($result) or die( mysql_error() ); while($row = mysql_fetch_assoc($result)) { $table .= ' <tr> <td width="150px">'.$row['firstname'].' '.$row['lastname'].'</td> <td><input type="checkbox" name="selectedstaff[]" value="'.$row['staff_id'].'" unchecked></td> </tr> '; } ?> <h4>Create Meeting Stage 2 - Meeting Attendance</h4> <p>Select which staff member's are to attend this meeting.</p> <form action="test2.php" method="post"> <div class="meeting png_bg"> <table> <?php echo $table; ?> </table> <br /> <input class="button" type="submit" value="Submit" /> </div> </form> <!-- End Page Content --> But i don't want to display the staff members where there staff_id is equal to, $chairperson or $secretary i can't seem to get this to work can anyone show me help please ? Quote Link to comment Share on other sites More sharing options...
jigsawsoul Posted January 24, 2010 Author Share Posted January 24, 2010 anyone please... ? need more information ? Quote Link to comment Share on other sites More sharing options...
jl5501 Posted January 24, 2010 Share Posted January 24, 2010 Can you provide more information regarding your table structure please Quote Link to comment Share on other sites More sharing options...
jigsawsoul Posted January 24, 2010 Author Share Posted January 24, 2010 FULL PAGE: <?php session_start(); include '../../_library/opendb.php'; include '../../_functions/login.php'; include '../../_functions/nav-admin.php'; adminAuthenticate (); $page = "meeting"; // ****** Add Meeting Add.php Information To Database ****** $title = $_POST['title']; $tor = $_POST['tor']; $chairperson = $_POST['chairperson']; $secretary = $_POST['secretary']; $query = "INSERT INTO web_occurrences (occurrence_id) VALUES ('')"; if (mysql_query ($query)) { $occurrenceid = mysql_insert_id(); $_SESSION['occurrenceid'] = $occurrenceid; } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Error. please can't admin </div> </div>"; header('Location: list.php'); } $query = "INSERT INTO web_meeting (occurrence_id, title, reference) VALUES ('$occurrenceid', '$title', '$tor')"; if (mysql_query ($query)) { // Added Meeting Information } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Error. please can't admin </div> </div>"; header('Location: list.php'); } $query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$chairperson', 'Chairperson')"; if (mysql_query ($query)) { // Added Chairperson } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Error. please can't admin </div> </div>"; header('Location: list.php'); } $query = "INSERT INTO web_roles (occurrence_id, staff_id, role) VALUES ('$occurrenceid', '$secretary', 'Secretary')"; if (mysql_query ($query)) { // Added Secretary } else { $_SESSION['message'] = " <div class='notification error png_bg'> <a href='#' class='close'><img src='http://stuweb.cms.gre.ac.uk/~hr728/_web/_resources/images/icons/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Error. please can't admin </div> </div>"; header('Location: list.php'); } ?> <?php include("../../_template/header-admin.php"); ?> <body> <div id="body-wrapper"><div id="sidebar"><div id="sidebar-wrapper"> <?php include("../../_template/profile-links.php"); ?> <?php navigation ($page); ?> <?php include("../../_template/messages.php"); ?> </div></div> <div id="main-content"> <?php include("../../_template/no-js.php"); ?> <?php include("../../_template/page-head.php"); ?> <!-- Page Content --> <?php $result = "SELECT * FROM web_staff LEFT JOIN web_login ON web_staff.login_id=web_login.login_id WHERE userlevel = '2' ORDER BY firstname ASC"; $result = mysql_query($result) or die( mysql_error() ); while($row = mysql_fetch_assoc($result)) { $table .= ' <tr> <td width="150px">'.$row['firstname'].' '.$row['lastname'].'</td> <td><input type="checkbox" name="selectedstaff[]" value="'.$row['staff_id'].'" unchecked></td> </tr> '; } ?> <h4>Create Meeting Stage 2 - Meeting Attendance</h4> <p>Select which staff member's are to attend this meeting.</p> <form action="add3.php" method="post"> <div class="meeting png_bg"> <table> <?php echo $table; ?> </table> <br /> <input class="button" type="submit" value="Submit" /> </div> </form> <!-- End Page Content --> <?php include("../../_template/footer.php"); ?> </div></div> </body> </html> <?php unset ($_SESSION['message']); ?> <?php include '../../_library/closedb.php'; ?> THANK YOU [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
jigsawsoul Posted January 24, 2010 Author Share Posted January 24, 2010 so i have a list of all staff member's with a checkbox next to them. $chairperson = $_POST['chairperson']; $secretary = $_POST['secretary']; is getting the person selected to be the $chairperson from the staff member's and $secretary is doing the same I don't want the chairperson or secretary to be on the page. i want to display all staff members over then the chairperson and secretary $secretary and $chairperson are qual to staff_id's Quote Link to comment Share on other sites More sharing options...
jigsawsoul Posted January 24, 2010 Author Share Posted January 24, 2010 really guys. can't be done ? Quote Link to comment Share on other sites More sharing options...
jl5501 Posted January 24, 2010 Share Posted January 24, 2010 So, as I understand what you are trying to do, then your query should read : SELECT * FROM web_staff LEFT JOIN web_login ON web_staff.login_id=web_login.login_id WHERE userlevel = '2' and staffid <> '$chairperson' and $staffid <> '$secretary' ORDER BY firstname ASC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.