title: how to display the query records in php
body: <p>Hi in the below it's returns the SUCCESSFUL message but I am not getting the id,groupnames.
  How to execute the select query in the below code.I wan the record details of id and groupname.</p>
  
  <p>Can any one help me </p>
  
  <p><strong>php</strong></p>
  
  <pre><code>case "DispalyGroupDetails":
          $userId = authenticateUser($db, $username, $password);
  
          if ($userId != NULL)
  
          {
  
              if (isset($_REQUEST['username']))           
              {               
                   $username = $_REQUEST['username'];
  
  
  
                   $sql = "select Id from users where username='$username' limit 1";
  
                   if ($result = $db-&gt;query($sql))
  
                   {
                          if ($row = $db-&gt;fetchObject($result))
  
                          {    
  
                                       $sql = "select g.id,g.groupname from `users` u, `friends` f,`group` g 
                                       where u.Id=f.providerId and f.providerId=g.providerId";
                                      echo $sql;
  
  
                                       if ($db-&gt;query($sql))
                                       {
                                          $out = SUCCESSFUL;
                                       }
                                       else
                                       {
                                              $out = FAILED;
                                       }
  
                          }
                          else
                          {
                              $out = FAILED;                      
                          }
                   }
  
                   else
                   {
                          $out = FAILED;
                   }              
              }
  
              else
              {
                      $out = FAILED;
              }           
          }
          else
          {
              $out = FAILED;
          }   
      break;
  </code></pre>