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
UPLOAD IMAGES NOT WORKING!
Hi there i have a upload script in which it uploads the picture to a folder than creates two thumbna
Google Map
I have done Google Map Integration for one my project. But for that we need the "latitude and l
why is it over writing
Code: $filepaths[] = $_FILES['new_image'];
foreach ($filepaths as $filepath)
{
$imagename =
Count number of records in all the tables with a querry URGENT PLEASE...
I downloaded ORACLE 9I DATA DUMP into my comp. There are number of tables. I need to find out the
some questions
Hello,
I am looking for the answers for following questions:
1) Does PHP support overl
tag inside php... hi
Code: <?php echo "<td width="$columnWidth%" align=&Problem with PHP/mySQL login code Hello,
There is an error in my login script and I can't figure out what it is... I believe Form a inline view based on the results of the previous query? Hi Experts,
Can we form a inline view on the results of a previous query (another inline view)? how to get sn motherboard Hello.
I want to get serial number motherboard, cpu and else hardware.
Can You show me sam WELCOME SCREEN first of all let me tell you what does my script do,
it´s a very simple query to show a e
|