Jump to content

Query all tables in a database?


Roy766

Recommended Posts

Hello all!

 

I have a database with six different tables in it ("word", "idea", etc.). Each table has a timestamp column and what I want to do is have a page that lists all the rows entered within a certain time frame (a "New" page). In order to do this, though, I would have to query all six tables and then echo the rows created within a certain time frame. Is this possible?

 

Thanks in advance!

 

Also, if anyone has a suggestion on how to return all rows from a certain date onwards, that would be appreciated too.

Link to comment
https://forums.phpfreaks.com/topic/239476-query-all-tables-in-a-database/
Share on other sites

It will work by the date, if the date is stored in a date, datetime, or timestamp column.  Having 6 queries in a page is a little bit of overhead, but hey, this page you are looking at was created with 16 queries (shown at the bottom).  However, storing duplicate data is not something that I would recommend.  If you are storing to two different tables, how do you handle edits, and/or deletions?

No need for edits or deletions. If it becomes absolutely necessary I can manually edit the data, but it shouldn't be for the purpose of the site (only one person will be adding content, and he'll be copying the content from a document previously proofread and edited because he'll be printing it out as well as uploading it). In addition, there's no need to store very much content in the "new" table; any row after the most recent twenty can be automatically cleared. It's simple but efficient and works perfectly for the system I need.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.