Unlimited Accordion Recursion

Unlimited Accordion Recursion

Trying to set up a function that will recurse though a database and build out several Accordions however at the moment it's not producing any Accordions

You can see what i mean via this link  http://maskedriders.info/test.php

Here are my 2 relevent functions

  1. function accordionfill($name, $content){
  2. $echostate = '<div>';
  3. $echostate .= '<h3><a href="#">'.$name.'</a></h3>';
  4. $echostate .= '<div>'.$content.'</div>';
  5. $echostate .= '</div><div>';
  6. return $echostate;
  7. };//function 

  1. function accordionmenu($ParentID, $accordionID){
  2. $echostate .= '<!-- Accordion -->';
  3. $echostate .= '<div id="accordion'.$accordionID.'">';
  4. $menuresult = mysql_query("SELECT * FROM Menus WHERE ParentID = $ParentID ORDER BY MenuID ASC")or die(mysql_error());
  5. while ($menucheck=mysql_fetch_assoc($menuresult)){
  6. $MenuID = $menucheck['MenuID'];
  7. $NewWidth = $menucheck['NewWidth'];
  8. if ($NewWidth > 0){
  9. $NewWidth = $menucheck['NewWidth'];
  10. }else{
  11. $NewWidth = 256;
  12. };//if/else for width setting
  13. $ParentID = $menucheck['ParentID'];
  14. $UploadID = $menucheck['UploadID'];
  15. $result1 = mysql_query("SELECT * FROM Uploads WHERE UploadID = $UploadID")or die(mysql_error());
  16. $check1=mysql_fetch_assoc($result1);
  17. $imgpth0 = $absoluteBASE.$check1['UploadDir'].'UPLOAD_'.$check1['UploadID'].'.'.$check1['UploadType'];
  18. $Dimgpth0 = $secureBASE.$check1['UploadDir'].'UPLOAD_'.$check1['UploadID'].'.'.$check1['UploadType'];
  19. if ($UploadID > 0){
  20. $name = showimmage($imgpth0, $Dimgpth0, 256);
  21. }else{
  22. $name = $menucheck['Name'];
  23. };//if for text or image name
  24. $accordionID++;
  25. $content2 = accordionmenu($MenuID, $accordionID);
  26. $echostate .= accordionfill($name, $content2);
  27. };//while for menu preview
  28. return $echostate;
  29. };//function