yandoo Posted March 6, 2007 Share Posted March 6, 2007 Hi there all, If anybody could help me id be most greatful. As you can see in the attachment i have 4 tables that detail the loan of laptops to Teachers, by users. My problem is that when i go to fill in the loan form i have a dynamic drop down menu that details the laptops avaliable for loan. When a laptop is loaned the "completed Y/N" section of the form on the Loan table is entered as N, which means The loan in NOT completed! The loan completed Y/N section is complete when a the laptop is returned. I need to make it so the dynamic drop down menu detailing the avliable laptops only displays the laptops that are avaliable e.g. if they are out on loan "Completed Y/N" (in this case N) they do not appear. When searching for records under "completed Y/N" (in this case Y) it will display all of the records that have Y in completed section, including those that have previously been loaned and returned. If i search for "completed Y/N" (in this case N) it displays only the few laptops on loan that have NOT been completed.....But my problem is i need the reverse, of this result. I want these laptop records to be removed from the list, NOT to be the only ones that appear. So....searching for records that are "completed Y/N" (this case N) it would usually display records that are not completed. i need it to NOT display them (N) and to display the records that have have been completed (e.g. records completed != N) Please help me!! I realise that i do not necessarly need to base this query around the "completed Y/N" part of Loan form, but am trying for the moment. This code is on the Add Loan form, creating dynamic drop down menu from laptop table <select name="LaptopName"> <option value="-----------------">-------------------</option> <?php do { ?><option value="<?php echo $row_laptopName['LaptopName']?>"><?php echo $row_laptopName['LaptopName']?></option> <?php } while ($row_laptopName = mysql_fetch_assoc($laptopName)); $rows = mysql_num_rows($laptopName); if($rows > 0) { mysql_data_seek($laptopName, 0); $row_laptopName = mysql_fetch_assoc($laptopName); } ?> This bit of code is when querying completed Y/N bit: $query_loanI = "SELECT * FROM loan WHERE Complete = 'N' ORDER BY LoanID ASC"; $query_limit_loanI = sprintf("%s LIMIT %d, %d", $query_loanI, $startRow_loanI, $maxRows_loanI); $loanI = mysql_query($query_limit_loanI, $laptop_loan) or die(mysql_error()); $row_loanI = mysql_fetch_assoc($loanI); if (isset($_GET['totalRows_loanI'])) { $totalRows_loanI = $_GET['totalRows_loanI']; } else { $all_loanI = mysql_query($query_loanI); $totalRows_loanI = mysql_num_rows($all_loanI); p.s. I can email more code if needed? [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/41423-please-please-help-inverse-recordset/ Share on other sites More sharing options...
willpower Posted March 6, 2007 Share Posted March 6, 2007 I must be failing to understand this. You say that you want all items that are not set to 'N' if that is correct then ask for that in your SQL WHERE completed <>'N' Link to comment https://forums.phpfreaks.com/topic/41423-please-please-help-inverse-recordset/#findComment-200746 Share on other sites More sharing options...
yandoo Posted March 6, 2007 Author Share Posted March 6, 2007 Hi, yes that is the gist of the idea accept this detail: I want the records that completed = N to NOT appear!! I can search for completed = Y as it will display all previous records of completed loans. stay with me..... Link to comment https://forums.phpfreaks.com/topic/41423-please-please-help-inverse-recordset/#findComment-200819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.