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 7660331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:27:05+00:00 2026-05-31T13:27:05+00:00

I have produced a result from the following query as shown below.Now the result

  • 0

I have produced a result from the following query as shown below.Now the result I got is an array in which all the results are stored according to ‘portfolio_id’… I need to print different array of results for different portfolio_id. How is it possible?

For example when portfolio_id is 1 it will produce a frame of 9images ,portfolio_id is 18 it must produce another frame of 9 images…

$portfolio_item_query=$ilance->db->query("SELECT * FROM " . DB_PREFIX . "portfolio AS p,
                                        " . DB_PREFIX . "portfolio_images AS pi,
                                          " . DB_PREFIX . "users AS u,
                                        " . DB_PREFIX . "subscription_user AS su,
                                        " . DB_PREFIX . "portfolio_items AS it
                                       WHERE p.portfolio_id = it.portfolio_id
                                       AND u.user_id = p.user_id 
                                      AND it.id = pi.portfolio_item_id 
                                     AND it.portfolio_id='".$portfolio['portfolio_id']."'
                                      GROUP BY it.id ORDER BY it.id ASC LIMIT 0,9");
                            $num_rows=$ilance->db->num_rows($portfolio_item_query); 
                            if ($num_rows > 0)
        {
            while ($portfolio_item = $ilance->db->fetch_array($portfolio_item_query))
            {  
            $portfolio_html.='<li><img height="57" width="57" src="images/portfolio_uploads/orig_'.$portfolio_item['image'].'"></a></li>';

                }
                    echo $portfolio_html;
         }
  • 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-31T13:27:06+00:00Added an answer on May 31, 2026 at 1:27 pm

    You could loop through the entire data set, keeping track of the portfolio_id of each row. Then, each time the portfoio_id changes, start a new list.

    If I’m understanding correctly, this should help. Here’s how you could separate a generic set of images into different unordered lists using group_id to define groups:

    // select the entire set, group by whichever field defines your groups
    $result = mysql_query("SELECT image_path FROM portfolio ORDER BY group_id");
    
    // the group_id associated with the currently growing <ul>
    $current_id = null;
    
    while ($row = mysql_fetch_array($result))
    {  
        $group_id = $row['group_id'];
    
        // the first list
        if (is_null($current_id))
        {
            $current_id = $group_id;
            echo "<ul>\n";
        }
    
        // if a new group_id is encountered, close the list and start a new one
        elseif ($group_id != $current_id)
        {
            $current_id = $group_id;
            echo "</ul>\n\n<ul>\n";
        }
    
        echo "<li><image src=\"" . $row['image_path'] . "\"></li>\n";
    }
    echo "</ul>\n";
    

    The table looks like this:

    mysql> SELECT * FROM portfolio;
    +------------+----------+
    | image_path | group_id |
    +------------+----------+
    | a.png      |        1 |
    | b.png      |        3 |
    | c.png      |        4 |
    | d.png      |        3 |
    | e.png      |        3 |
    | f.png      |        1 |
    | g.png      |        4 |
    +------------+----------+
    7 rows in set (0.00 sec)
    

    And the output of the above program looks like this:

    <ul> 
    <li><image src="a.png"></li> 
    <li><image src="f.png"></li> 
    </ul> 
    
    <ul> 
    <li><image src="b.png"></li> 
    <li><image src="d.png"></li> 
    <li><image src="e.png"></li> 
    </ul> 
    
    <ul> 
    <li><image src="c.png"></li> 
    <li><image src="g.png"></li> 
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear all, I have a select query that currently produces the following results: DoctorName
I have the following echo from a result of a query (to display when
I have a select query which produces the following: select customers.city , books.title from
I have the following MySQL query, which produces the result I want: SELECT `l`.`status`,
I have an array that is produced from people wanting to reserve a time
I have a query that produces the following results: table1: degree_code occupation_code degree_completions degree_level
I have the following query which runs perfectly well on both Oracle and SQL
For example I have the following query (see How to produce a result set
We have a SQL Server DB with 150-200 stored procs, all of which produce
I have a select query that currently produces the following results: Description Code Price

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.