Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7642375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:10:26+00:00 2026-05-31T09:10:26+00:00

The following is a query results stored in $performset. $sqlperform = $ilance->db->query( SELECT q.title_per

  • 0

The following is a query results stored in $performset.

      $sqlperform = $ilance->db->query("
            SELECT
            q.title_per 
            FROM " . DB_PREFIX . "perform q
            LEFT JOIN " . DB_PREFIX . "perform_answers a ON (q.cid =  a.cid)
            WHERE a.user_id = '" . $res_vendor['user_id'] . "'
        ");
        if ($ilance->db->num_rows($sqlperform) > 0)
        {
            while ($rows = $ilance->db->fetch_array($sqlperform))
            {  
            $perform .='<li>'.$rows['title_per'].'</li>';  
                }
                      $performset .='<ul>'.$perform.'</ul>';
         }      

  echo   

The values i get from particular variable are
Adobe Flex, C++ Builder, C#/.Net, C/C++/Unix, C/C++/Win32SDK, Oracle DBA,
Data Entry,

The out put I have got form this is

Adobe Flex, C++ Builder, C#/.Net, C/C++/Unix, C/C++/Win32SDK, Oracle DBA, 
Data Entry, Oracle DBA, Adobe Flex ,C++ Builder, C#/.Net , Data Entry
C/C++/Unix, C/C++/Win32SDK

But the output I need is

Data Entry    C++ Builder   C/C++/Win32SDK
Oracle DBA    C#/.Net
Adobe Flex    C/C++/Unix

The html that works for this is as such

    <ul>
                            <li>Data Entry</li>
                            <li>Oracle DBA</li>
                            <li>Adobe Flex</li>
                        </ul>
                        <ul>
                            <li>C++ Builder</li>
                            <li>C#/.Net</li>
                            <li>C/C++/Unix</li>
                        </ul>

How can i script it in php to produce such n number of results

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:10:27+00:00Added an answer on May 31, 2026 at 9:10 am

    Use of array_chunk() is perfect in this case.

    Take a looks at this example, might looks complicated but might be how you need

        if ($ilance->db->num_rows($sqlperform) > 0)
        {
            $drows = array();
    
            while($rows = $ilance->db->fetch_array($sqlperform)) {  
               $drows[] = $rows;
            }
    
    
            $chunks = array_chunk($drows, 3, true);       
            foreach($chunks as $chunk) {
              $set = "<ul>";
                 foreach($chunk as $key => $value) {
                    $set .= '<li>'.$value['title_per'].'</li>';  
                 }
              $set .= "</ul>";
              echo $set;
            }
    
          }
    

    TESTED, but For test, I used the following codes, which simulates the situation above

    $ar1  = array(1,2,3); //db row
    $ar2 = array($ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1,$ar1);
    
    $drows = $ar2; //collection of db rows
    $chunks = array_chunk($drows, 3, true);
    foreach($chunks as $chunk) {
      $set = "<ul>";
         foreach($chunk as $key => $value) {
            $set .= '<li>'.$key.$value[0].'</li>';  
         }
      $set .= "</ul>";
      echo $set;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: select count(L.ID) from LA inner join L on (LA.leadid
The following query returns strange results for me: SELECT `Statistics`.`StatisticID`, COUNT(`Votes`.`StatisticID`) AS `Score`, COUNT(`Views`.`StatisticID`)
Take the following linq query: var summary = results.Select(r => new { TotalPopulation =
I have a select query that currently produces the following results: Description Code Price
Dear all, I have a select query that currently produces the following results: DoctorName
I have the following query: select col1, sum( col2 ), count( col3 ) from
I have the following query: $sql = SET @rownum := 0; SELECT * FROM
I have the following query in sql: SELECT a1 FROM dbo.myProductNames WHERE keycode =
Using the following query and results, I'm looking for the most recent entry where
I have the following Sql Query that returns the type of results that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.