title: hide /show content in table while loop
body: <p><a href="http://i.stack.imgur.com/v96CE.png" rel="nofollow">here is the image of the output of the code given below
  </a>The code below displays a table with hide/show content.</p>
  
  <p>i want to display the username below the "username" heading of the table and the content that appears on clicking the "+" button should appear below their respective headers like project_name should appear under PROJECT NAME,project_id should appear under PROJECT ID and so on...</p>
  
  <p>if anyone could help...</p>
  
  <pre><code>    &lt;?php
  $hostname_ckumbh = "localhost";
  $database_ckumbh = "pmb_demo";
  $username_ckumbh = "root";
  $password_ckumbh = "";
  
  $ckumbh = mysql_pconnect($hostname_ckumbh , $username_ckumbh , $password_ckumbh) or trigger_error(mysql_error(),E_USER_ERROR);
  mysql_select_db($database_ckumbh , $ckumbh); 
  
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;style&gt;
  .button1 {
      width: 100%
  }.wid25{width:25% !important;float:left}
  
  .sign_cls {
      cursor: pointer;
      width: 10%;
      background: #09F;
      font-weight: bold;
      color: #FFF
  }
  .sign_cls2 {
      cursor: pointer;
      width: 10%;
      background: #900;
      font-weight: bold;
      color: #FFF
  }
  .sign_cls,.sign_cls2 {float: left;  width: 1% !important;}
  .date_cls {
      width: 90%;
  }
  .wid_25 {
      width: 25%;
      float: left;
      margin: 10px 0
  }
  .line_style td {
      width: 25%
  }
  &lt;/style&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  
  
  &lt;script type="text/javascript"&gt;
  function toggle(cls,cls2){
      if($("."+cls).is(":visible")){
          $("."+cls).hide("slow");    
          $("#"+cls2).removeClass('sign_cls2').addClass('sign_cls');      
      }else{
          $("."+cls).show("slow");
          $("#"+cls2).removeClass('sign_cls').addClass('sign_cls2');
      }
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table border="0%" align="center" width="100%" height="100%" &gt;
          &lt;tr class="line_style" align="center"&gt;
              &lt;/br&gt;
            &lt;td&gt;User Name&lt;/td&gt;
            &lt;td&gt;Project Name&lt;/td&gt;
            &lt;td&gt;Project ID&lt;/td&gt;
            &lt;td&gt;Task Details&lt;/td&gt;
            &lt;td&gt;Status&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php
  
  
      $record =mysql_query("SELECT `u_vemail` FROM `proj_user`");
      $i = 0;
      while($row=mysql_fetch_array($record))
      {
  
      $record2 =mysql_query("SELECT `project_name` , `project_id` , `task_details` , `date` , `status` FROM  `add_tasks` WHERE   `user_name`='$row[u_vemail]'");
  
  
  
      ?&gt;
  
          &lt;tr align="center"&gt;      
          &lt;td colspan="4"&gt;                
              &lt;div class="button1" onClick="toggle('hide&lt;?php echo $i;?&gt;','test&lt;?php echo $i;?&gt;')" style="float:left"&gt;
           &lt;span id="test&lt;?php echo $i;?&gt;" class="sign_cls"&gt;+&lt;/span&gt;&lt;span class="date_cls"&gt;&lt;?php echo $row["u_vemail"] ?&gt;&lt;/span&gt;
  
  
           &lt;/div&gt;  
  
           &lt;div class="hide&lt;?php echo $i;?&gt;" style="display:none;width:100%;float:left;"&gt;            
          &lt;?php
  
              while($row2 =mysql_fetch_array($record2))
          {   
  
  
          ?&gt;                                
                      &lt;div style="width:100%"&gt;
  
  
                          &lt;div class="wid_25"&gt;&lt;?php echo $row2["project_name"]; ?&gt;&lt;/div&gt;
                          &lt;div class="wid_25"&gt;&lt;?php echo $row2["project_id"]; ?&gt;&lt;/div&gt;
                          &lt;div class="wid_25"&gt;&lt;?php echo $row2["task_details"]; ?&gt;&lt;/div&gt;
                          &lt;div class="wid_25"&gt;&lt;?php echo $row2["status"]; ?&gt;&lt;/div&gt;                
                      &lt;/div&gt;
          &lt;?php 
          }
          ?&gt;&lt;/div&gt;                    
          &lt;/td&gt;                   
          &lt;/tr&gt;&lt;?php
          $i++;
      }
          ?&gt;        &lt;table&gt;
          &lt;/table&gt;
            &lt;/td&gt;
  
            &lt;/tr&gt;
  
        &lt;/table&gt;
        &lt;br/&gt;
        &lt;br/&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>