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

  • Home
  • SEARCH
  • 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 9106897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:26:44+00:00 2026-06-17T02:26:44+00:00

Could some fresh eyes please tell me what I’m doing wrong here? I’m sure

  • 0

Could some fresh eyes please tell me what I’m doing wrong here? I’m sure it’s something simple.

The sql query that retrieves the data set:

SELECT * FROM articles WHERE category='category' ORDER BY publish_date DESC, id DESC LIMIT 0, 10

The multidimensional array that I am trying to reach:

list [ 
    publish_date [
        0 [ id, title, body ]
        1 [ id, title, body ]
        2 [ id, title, body ]]
    publish_date [
        0 [ id, title, body ]
        1 [ id, title, body ]]
    publish_date [
        0 [ id, title, body ]
        1 [ id, title, body ]
        2 [ id, title, body ]
        3 [ id, title, body ]]]
Etc..

I have been fiddling with the following php function for a few hours now:

$result = $sql->prepareQuery($query_string);

// iterate through array and place results in an array at row index
$list = ['group_date' => ' '];
$r = 0;
while ($rows = mysql_fetch_assoc($result)) {
    if ($list['publish_date'] != $rows['pub_date']) {
        $list['publish_date'] = $rows['pub_date'];
        $r = 0;
        foreach ($rows as $key => $val) {
            $list['publish_date'][$r[$key = $val]];
        }
        $r++;
    }
    else {
        foreach ($rows as $key => $val) {
            $list['publish_date'][$r[$key = $val]];
        }
        $r++;
    }
}
// return result
print_r($list);
  • 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-06-17T02:26:45+00:00Added an answer on June 17, 2026 at 2:26 am

    Think you are making things to complicated:

    $list = array();
    $current_date = '';
    while ($rows = mysql_fetch_assoc($result)) {
        if ($current_date != $rows['pub_date']) {
            $current_date = $rows['pub_date'];
            $list[$current_date] = array();
        }
        $list[$current_date][] = $rows;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering if I could have some fresh eyes on this python script.
Googled out- could use some help here. I followed this excellent tutorial here (http://www.malteahrens.com/#/blog/howto-onenote-dev/)
Could some one guide me to create a APS logon token in .Net programmatically?
Could some one give me pointers to tutorials that explains how to write a
Iam getting the following error , could some one help me how to fix
I'm looking for an online introduction to occam 2. Could some one help me?
I could use some help with expression conversion. I have a method on a
Wondering if I could get some advice and direction on this following requirement: Need
I'm wondering what could be some consequences of reusing the names of built-in types
I was hoping someone could shed some light on a very odd behavior I've

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.