Retrieving the 25 most recently added entries from all tables in a MySQL databas
Posted on
16th Feb 2014 07:03 pm by
admin
Hello,
The code below works great. It creates a table that shows the 25 most recently added tables to a MySQL database called "sitefeather."
Each one of these tables has the following structure:
Code: id INT(11) NOT NULL auto_increment, site VARCHAR(1000) NOT NULL, action1 BIGINT(9) NOT NULL, action2 BIGINT(9) NOT NULL, createddatetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id), UNIQUE (site)
I would like to echo a list of "site" and "CURRENT_TIMESTAMP" for the 25 most recently added rows, regardless of which table they are in. This may be tricky since the number of tables is variable. Someone advised me that I would have to use a query involving INFORMATION_SCHEMA.TABLES. How can I do this?
Thanks in advance,
John
Code: echo "<table class="samples">";
$index = mysql_query("select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='sitefeather' order by CREATE_TIME desc limit 25");
while ($row = mysql_fetch_array($index))
{
echo '<tr><td><a href="sitesearch.php?find='.urlencode($row['TABLE_NAME']).'&searching=yes&search=search">'.$row['TABLE_NAME'].'</a></td></tr>';
}
echo "</table>";
No comments posted yet
Your Answer:
Login to answer
309
19
Other forums
Displaying pictures
i have worked my way through storing images in directory and storing the location in mySQL db.Now i
help with variable
I've got a problem, i want to echo some images depending on the $id, however for me to get that id i
Function module "DPS_CHECK_TABLE_EXISTS" not found (after OSS 1422843 impl)
Dear All,
I implemented Note OSS 1422843.
When i execute the new report RSPO20
HTML form problem
Ive made a form to that i want to send to my email via PHP. but when it send only the name's etc sen
calculator
I can't figure out why this code doesn't work. No error messages. Page loads.
Code: <
Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t
mail with attachment problems
Hi. I have the following code:
Code: else if(file_exists("site".$timp.".zip")
drop-down with sub-category appear
Hello,
i know how to build a simple dro-down list, im looking for a code when im gonna choose
form help
this doesn't work. i want the form action to go the location.href of the submit button chosen.. how
Using the $_GET variable to view certain records
Hello,
First let me explain my problem, I have 2 pages the first page pull a list of Guide ti