473,466 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

div loop onclick show recordsets results

201 New Member
how do i get this to loop through all record sets instead of just showing one record set on click for sub query?


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3.     function toggle_visibility(id) {
  4.        var e = document.getElementById(id);
  5.        if(e.style.display == 'block')
  6.           e.style.display = 'none';
  7.        else
  8.           e.style.display = 'block';
  9.     }
  10. //-->
  11. </script>
  12.  
  13. </head>
  14.  
  15. <body>
  16. <?php
  17. //c.sfk={$row['sfk']}
  18.  
  19. mysql_select_db($database_Del_Comments, $Del_Comments);
  20.  
  21. $result = sprintf("SELECT a.Id, a.Type, 
  22. a.Dates, 
  23. a.UIdFk as UIdFk, 
  24. b.Id as Did, 
  25. b.comment as Comment, 
  26. b.dates as Day, 
  27. b.sfk as Sfk ,
  28. aes_decrypt(e.ProfileName, '$Ukey') as Name,
  29. substr(i.Path, 4) as Path
  30. FROM 
  31. asstatusupdate as a   
  32. left join asstatusdata as b 
  33. on a.id = b.sfk 
  34. right join ASWebInfo as e
  35. on e.Uidfk = a.uidfk
  36. right join ASManyAlbums as f
  37. on f.UserId=a.uidfk
  38. right join ASAlbums as g
  39. on f.AlbumId=g.Id
  40. right join ASTitle as h
  41. on g.Id=h.AlbumId
  42. right join ASData as i
  43. on h.Id=i.TitleId
  44. where a.uidfk in (select friendid from asfriends where uidfk0='1') and i.DefaultProfilePic='Y' order by dates desc;
  45. ");
  46. $statusUpdate = mysql_query($result, $Del_Comments) or die(mysql_error());
  47.  
  48. $category_id = '';
  49.  
  50. echo '<table align="center" width="40%" border="3" cellpadding="0" cellspacing="0">'; 
  51. while($row = mysql_fetch_array($statusUpdate)) {
  52.     if ($row['Id'] != $category_id) {
  53.         $category_id = $row['Id'];
  54.  
  55.         // grab table variables    
  56.             $Type = $row['Type'];
  57.         $Dates = $row['Dates'];
  58.         $Comment = $row['Comment'];
  59.         $Name = $row['Name'];
  60.         $Path = $row['Path'];
  61.         $FriendId = $row['UIdFk'];
  62.         $SFK = $row['Sfk'];
  63.  
  64.         echo '<tr>';
  65.         echo '    <td align="center">', $Name, '<br><a href="source/source.php?FriendId=',$FriendId,'"><img src="',$Path,'" height="120" width="120" align="middle" border="3" /></a></td>';
  66.         echo '    <td align="center"> ',$Dates,'<br><br>',$Type,'<br/>',$Comment,'</td>'; 
  67.         echo '    <td>',$category_id,'</td>';
  68.         echo '    <td>',$SFK,'</td>';
  69.         echo '</tr>';
  70.     } // end of if
  71.  
  72. mysql_select_db($database_Del_Comments, $Del_Comments);
  73.     $comments= sprintf("SELECT 
  74.           c.sfk as sfk1,
  75.           c.UIdFk0,
  76.           d.Memo as Memo,
  77.           d.Date as Dates1,
  78.           e.ProfileName,
  79.           substr(i.Path, 4) as Path
  80.      FROM 
  81.      asmanystatusupdate as c
  82.      left join ascomments as d     on d.id = c.cfk
  83.      right join ASWebInfo as e     on e.Uidfk = c.uidfk0
  84.      right join ASManyAlbums as f     on f.UserId=c.uidfk0
  85.      right join ASAlbums as g     on f.AlbumId=g.Id
  86.      right join ASTitle as h     on g.Id=h.AlbumId
  87.      right join ASData as i     on h.Id=i.TitleId
  88.      where c.sfk={$row['Sfk']} AND c.uidfk0 in (select friendid from asfriends where uidfk0='1') and i.DefaultProfilePic='Y'  order by dates desc;
  89.      ");
  90. $statusComments = mysql_query($comments, $Del_Comments) or die(mysql_error());
  91.     while($user_row = mysql_fetch_array($statusComments)){
  92.         // test the query
  93.         //if($row['sfk'] == $user_row['sfk']) 
  94.         {
  95.  
  96.             $Dates1 = $user_row['Dates1'];
  97.             $Memo = $user_row['Memo'];
  98.             $Name1 = $user_row['Name'];
  99.             $Path1 = $user_row['Path'];
  100.             $FriendId1 = $user_row['UIdFk0'];
  101.             $SFK1 = $user_row['sfk1'];
  102.  
  103.             //row and cell for "outer" while        
  104.              echo '<tr>';
  105.              echo '<td colspan="4" style="padding-left:1em;">';
  106.                 // display table
  107.                 echo '<a href="#0'."$SFK1".'" onclick="toggle_visibility(\'foo1'."$SFK1".'\');" ;return false\" style=\"position:relative\">Click here to show records</a>'; // to show comment records
  108.                   echo '<div id="foo1'."$SFK1".'"style="position:relative;display:none">'; // to show comment records
  109.                 echo '<table align="center" width="60%" border="3" cellpadding="0" cellspacing="0">'; 
  110.                 echo '<tr>';
  111.                 echo '    <td align="center">',$Name1,'<br/><a href="source/source.php?FriendId=',$FriendId1,'"><img src="',$Path1,'" height="120" width="120" align="middle" border="3" /></a></td>';
  112.                 echo '    <td align="center" width="40%"> ',$Dates1,'<br/><br/><br/>',$Memo,'</td>';
  113.                 echo '    <td>' ,$category_id, '</td>'; 
  114.                 echo '    <td>',$SFK1,'</td>';
  115.                 echo '</tr>';
  116.                 echo '</table>';
  117.                 echo '</div>';  // for comment results show query
  118.             //end row and cell for outer while
  119.              //echo '</td>';
  120.              //echo '</tr>';
  121.  
  122.   echo '<form action="$editFormAction" method="post" name="form1" id="form1">';
  123.   echo '<a href="#'."$SFK1".'" onclick="toggle_visibility(\'foo'."$SFK1".'\');" ;return false\" style=\"position:relative\">Click here to toggle visibility of element #foo</a>';
  124.   echo '<div id="foo'."$SFK1".'"style="position:relative;display:none">';echo '<table align="center">';
  125.     echo '<tr valign="baseline">';
  126.       echo '<td nowrap="nowrap" align="right">Memo:</td>';
  127.       echo '<td><input type="text" name="Memo" value="" size="32" /></td>';
  128.     echo '</tr>';
  129.     echo '<tr valign="baseline">';
  130.       echo '<td nowrap="nowrap" align="right">&nbsp;</td>';
  131.      echo ' <td nowrap="nowrap" align="right">&nbsp;</td>';
  132.    echo ' </tr>';
  133.     echo '<tr valign="baseline">';
  134.      echo ' <td nowrap="nowrap" align="right">&nbsp;SFK:' ."$SFK1". '</td>';
  135.      echo ' <td><input type="submit" value="Insert record" /></td>';
  136.    echo ' </tr>';
  137.  echo ' </table>';
  138.   echo '<input type="hidden" name="Id" value="" />';
  139.   echo '<input type="hidden" name="Id" value="" />';
  140.  echo ' <input type="hidden" name="SFk" value="' ."$SFK1". '" />';
  141.  echo ' <input type="hidden" name="MM_insert" value="form1" />';
  142.  echo '</form>';
  143. echo '</div>';
  144.         } // end of if
  145.  
  146.     } // end of while loop
  147. }// end of main loop
  148. echo '</table>';
  149. ?>
  150.  
May 17 '11 #1
0 1215

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Maurice | last post by:
Hi does anyone know if it's possible in .NET to display a multicolumn list like in MSAccess? I'm building an application in which a user can enter a search text and the application will then show...
2
by: Mike Wilson | last post by:
I'm trying to get a loop going based on my VB code below in Access. I've tested the code by selecting an individual record set and clicking the command 5 button. It works. Now instead of clicking...
4
by: Dica | last post by:
i apologize for what is no doubt a very rudimentary question, but i'm still trying to wrap my brain around .net coding habits. in classic asp, if i wanted to show search results, i'd just post the...
4
MMcCarthy
by: MMcCarthy | last post by:
The following code is simply an example of some code that processes through two recordsets. It can be helpful for anyone curious as to how to start processing with recordsets (Which objects to refer...
5
by: Eglute | last post by:
Hello I want to show the results of database query in Visual basic. Do you know how to do this? I want to show the results in objects such as label or text box. Please help me. My code is: Dim db...
1
by: Eglute | last post by:
Hello I want to show the results of MS Access database query in Visual basic. Do you know how to do this? I want to show the results in objects such as label or text box. Please help me. My code is:...
17
by: OllyJ | last post by:
Hi guys, have searched for this but can't find an answer... I have a number of combo boxes that limit a continuous subform in the header of the main form. Currently, if they are blank, all...
3
by: Chris Patsacos | last post by:
I have used <option value> type in html to create a selectable price list catalog. I also modified a .js to meet my needs (follows). My question is how to show the results "var SUbtotal" and "var...
1
by: Iridaki | last post by:
Hello, i am new with access vba, and i have a certain question about a specific code. I want to create a list of buttons on a form (or one button),that each one represent a pollutant of the...
1
by: wizardry | last post by:
it only shows for the top record. when i click on one hyper link say on record 5 it shows the form on record 14 and not on 5. i need it to show the record on all hyperlink records ids. Do i need...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.