Copy link to clipboard
Copied
Good Day,
I would like to create a spry accordion from a Recordset.
My recordset has a category and exception. So there could be 5 rows with the same category.
I would like to create an accordion that would show the category once and the content would list each exception within that category.
Just not sure how to creat the loop for this as I want it to loop on change of category.
Any tips is greatly appreciated!
Copy link to clipboard
Copied
Ok, figured out a solution with two queries.
1st query contains just a query grouping all the categories together. I then run a loop on the accordion, tab section to list each category.
Inside that loop I run another query that is equal to the category in the loop. From there I run another loop in the content section that displays all the results of that category.
Copy link to clipboard
Copied
Hey nstratton. Thanks for that info. I also want to incorporate my Recordsets into accordions. Could you please send me the coding to do so? Your explanation is a bit too advanced for me at this stage. Much appreciated. G
Copy link to clipboard
Copied
I am trying to put the code, but it is converting to HTML. Give me a few minutes to figure that out.
Copy link to clipboard
Copied
<?php
$i=0; $j=0; ?> </p> <strong>Exception Categories:</strong> <div id="CollapsiblePanelGroup5" class="CollapsiblePanelGroup"> <?php do { ?><?php $category=$row_Recordset4['category']; mysql_select_db($database_loanauditv2, $loanauditv2);$query_Recordset5 = "SELECT * FROM exception_list WHERE category = '$category' Order by exception ASC";$Recordset5 = mysql_query($query_Recordset5, $loanauditv2) or die(mysql_error());$row_Recordset5 = mysql_fetch_assoc($Recordset5);$totalRows_Recordset5 = mysql_num_rows($Recordset5);?> <div class="CollapsiblePanel"> <div class="CollapsiblePanelTab" tabindex="0"><?php echo $row_Recordset4['category']; ?></div> <div class="CollapsiblePanelContent"> <table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000"> <tr> <td width="50%"><strong>Exception</strong></td> <td width="10%"> </td> <td width="15%"><strong>Action Needed</strong></td> <td width="30%"><strong>Notes</strong></td> </tr> <?php do {?> <tr <?php// technocurve arc 3 php bv block2/3 startecho " style=\"background-color:$color\"";// technocurve arc 3 php bv block2/3 end?>> <td><?php echo $row_Recordset5['exception']; ?></td> <td><label for="checkbox"> <div align="center"> <input type="checkbox" name="checkbox[]" id="checkbox" value="<?php echo $i++;?>"> <input type="hidden" name="exception_by_id[]" value="<?php echo $row_Recordset1['id']; ?>"> <input type="hidden" name="loan_id[]" value="<?php echo $_SESSION['loanauditid'];?>"> <input type="hidden" name="loan_officers_id[]" value="<?php echo $_SESSION['loanofficerid'];?>"> <input type="hidden" name="exception_id[]" value="<?php echo $row_Recordset5['id']; ?>"> <input type="hidden" name="exception_category[]" value="<?php echo $row_Recordset5['category']; ?>"> <input type="hidden" name="exception[]" value="<?php echo $row_Recordset5['exception']; ?>"> <input type="hidden" name="exception_severity[]" value="<?php echo $row_Recordset5['severity']; ?>"> </div> </label></td> <td><p> <label for="action_needed"></label> <select name="action_needed[]" id="action_needed"> <option value="Yes">Yes</option> <option value="No" selected>No</option> </select> <br> </p></td> <td><label for="notes"></label> <textarea name="notes[]" id="notes"></textarea></td> </tr> <?php// technocurve arc 3 php bv block3/3 startif ($color == $color1) { $color = $color2;} else { $color = $color1;}// technocurve arc 3 php bv block3/3 end?> <?php } while ($row_Recordset5 = mysql_fetch_assoc($Recordset5)); ?> </table> </div> </div> <?php } while ($row_Recordset4 = mysql_fetch_assoc($Recordset4)); ?><input type="submit" name="button" id="button" value="Next"> </div><p> </p>
Find more inspiration, events, and resources on the new Adobe Community
Explore Now