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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:15:25+00:00 2026-05-23T09:15:25+00:00

I am working on a project management system and having to use multiple MySQL

  • 0

I am working on a project management system and having to use multiple MySQL tables (messages, todo items, events, etc.) to pull and sort data from into a structured format using PHP.

The format should be similar to this

<p><b>Today</b></p>
<p>
  Todo Item, Item name, Item Description <br />
  Todo Item, Item name, Item Description <br />
  Message,   Message title               <br />
  Todo Item, Item name, Item Description <br />
  Todo Item, Item name, Item Description <br />
  Message,   Message title               <br />
</p>
<p><b>June 22, 2011</b></p>
<p>
  Todo Item, Item name, Item Description <br />
  Todo Item, Item name, Item Description <br />
  Todo Item, Item name, Item Description <br />
  Message,   Message title               <br />
  Todo Item, Item name, Item Description <br />
  Message,   Message title               <br />
</p>

Example MySQL tables are below:

CREATE TABLE `todo` (
  `id` int(12) NOT NULL auto_increment,
  `item` varchar(255) NOT NULL default '',
  `description` text NOT NULL,
  `created` int(12) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

INSERT INTO `todo` (`id`, `item`, `description`, `created`) VALUES
(1, 'test to-do list 1', 'this is simply a test 1', 1308847222),
(2, 'test to-do list 2', 'this is simply a test 2', 1308847318),
(3, 'test to-do list 3', 'this is simply a test 3', 1308847371),
(4, 'test to-do list 4', 'this is simply a test 4', 1306847441),
(5, 'test to-do list 5', 'this is simply a test 5', 1306848208);

CREATE TABLE `messages` (
  `id` int(12) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `message` text NOT NULL,
  `created` int(12) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;

INSERT INTO `messages` (`id`, `title`, `message`, `created`) VALUES
(1, 'test messages 1', 'this is simply a test 1', 1308847222),
(2, 'test messages 2', 'this is simply a test 2', 1308847318),
(3, 'test messages 3', 'this is simply a test 3', 1308847371),
(4, 'test messages 4', 'this is simply a test 4', 1306847441),
(5, 'test messages 5', 'this is simply a test 5', 1306848208);

What would be the best way to handle this efficiently?

  • 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-23T09:15:26+00:00Added an answer on May 23, 2026 at 9:15 am

    A union query to retrieve all the items:

    SELECT DATE(created) AS d, item, description, 'todo' AS src
    FROM todo
    
    UNION
    
    SELECT DATE(created) AS d, title, message, 'messages' AS src
    FROM messages
    
    ORDER BY created
    

    Then a simple state machine to handle output:

    $prev_date = null;
    $first = true;
    while($row = mysql_fetch_assoc($query_results)) {
       if ($prev_date <> $row['d') {
            if (!$first) {
                echo "</p>';
            }
            echo "<p><b>{$row['d']</b></p><p>";
       }
       echo " ... rows stuff<br />";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Project management system on PHP (CodeIgniter framework), Mysql, AJAX,
I'm working on database designs for a project management system as personal project and
I'm working on a google apps based application - its a project management system
I'm working on my project: [Beer Pong Management System][1], a Windows Forms application. I
i am working on a project of online resume management system and i am
I am working on a PHP-based project management system that allows users to upload
I'm working a project to replace a Resource Management system (QuickTime Resource Manager on
I am working on a project management web application. The user has a variety
I am working on project -online file management where we have to tore file
i am working on a online file management project.In which we are storing references

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.