Author |
Message |
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm

Joined: Aug 13, 2009
Posts: 1123
|
Posted:
Wed Sep 30, 2009 4:21 pm |
|
Does anyone know what is the code to get the numbers of tables from PHPmyadmin
I tried but it gives me 0
 |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Wed Sep 30, 2009 5:11 pm |
|
The number of queries or the number of tables? |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Thu Oct 01, 2009 12:11 am |
|
Yeah I wanna show the number of tables on the footer. Thanks in advance |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Sat Oct 03, 2009 10:44 am |
|
|
|
 |
xGSTQ
Involved


Joined: Feb 03, 2006
Posts: 269
|
Posted:
Mon Oct 05, 2009 4:48 am |
|
well im not sure of the process to add the sql queries in total, that's a nuke evolution feature by default and not ravens nuke, in fact im not sure its possible to do with ravens nuke, but ill show you how to add the time load in seconds instead ! lol
in your theme.php find functionfooter() {
add to the globals
$total_time and $start_time
now add this code
Code: $mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$end_time = $mtime;
$total_time = ($end_time - $start_time);
$total_time = "".substr($total_time,0,5)." "._SECONDS."";
|
now if you want to call the page load in seconds simply add
Page Generation: $total_time to your theme footer
That will display Page Generation: 0.088 Seconds counting the time to load the page !
Have fun |
|
|
|
 |
Palbin
Site Admin

Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Mon Oct 05, 2009 7:38 am |
|
We have added some logic to display "ALL" queries at the bottom of the page when enabled for admins only. I know that is not what you want.
Why do you want to see the number of tables queried? |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan.
Last edited by Palbin on Mon Oct 05, 2009 8:43 am; edited 1 time in total |
|
|
 |
xGSTQ

|
Posted:
Mon Oct 05, 2009 7:41 am |
|
What is "apge" bud
I can only presume he has seen the feature in Nuke Evolution and wants to replicate it... it is rather mundane though I agree, I cant see the point for it either. |
|
|
|
 |
Palbin

|
Posted:
Mon Oct 05, 2009 8:43 am |
|
xGSTQ wrote: | What is "apge" bud
I can only presume he has seen the feature in Nuke Evolution and wants to replicate it... it is rather mundane though I agree, I cant see the point for it either. |
It was supposed to be "page" (corrected) |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Mon Oct 05, 2009 11:43 am |
|
Palbin. I just want to know know what kind of codes I have to use to show the numbers of tables from phpMyadmin. I would like to know. Just simple.
Thank xGSTQ but I know already that one. Thanks anyway. I want to get the numbers of my tables on the botton.
?? |
|
|
|
 |
duck
Involved


Joined: Jul 03, 2006
Posts: 273
|
Posted:
Mon Oct 05, 2009 1:22 pm |
|
Here you can copy and paste this function where you may need it (ie mainfile.php or in your theme.php) and then call and echo its results:
Code:function tablecount(){
global $db, $dbname;
if(!empty($dbname)){
$sql = "SHOW TABLES FROM $dbname";
$result = $db->sql_query($sql);
$numtables = $db->sql_numrows($result);
$db->sql_freeresult($result);
return $numtables;
}
}
|
|
Last edited by duck on Tue Oct 06, 2009 9:59 am; edited 1 time in total |
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Mon Oct 05, 2009 11:57 pm |
|
Thanks for your help duck but what u mean to call an echo, from where? |
Last edited by hicuxunicorniobestbuildpc on Tue Oct 06, 2009 2:03 am; edited 1 time in total |
|
|
 |
Raven

|
Posted:
Tue Oct 06, 2009 12:41 am |
|
His function returns the number of tables in $numtables. So you would call the function like: $numtables = tablecount($dbname);
Then to display it on your page you would echo the response: echo $numtables;
$numtables = tablecount($dbname);
echo $numtables;
Or you could just do: echo tablecount($dbname); |
|
|
|
 |
hicuxunicorniobestbuildpc

|
Posted:
Tue Oct 06, 2009 1:58 am |
|
Thanks Raven for taking the time but I am a little confused with that. Can you be a little more specific but I tried but it doesnt show on the footer.
I dont know if I have to use this function on mainfile or in footer.php.
How could be done if I wanna use it on footer instead of mainfile.php |
|
|
|
 |
xGSTQ

|
Posted:
Tue Oct 06, 2009 2:24 am |
|
I would place it in your theme.php and call it in the function themefooter()
Were presuming since you knew how to add the time that you would be able to add this one as well, that's why they haven't explained it so well... all it is is a simple print to screen now, duck has done the hard part of connecting with the DB
zip up your theme.php or have another go, its not actually as hard as you think |
|
|
|
 |
duck

|
Posted:
Tue Oct 06, 2009 9:58 am |
|
Sorry as xGSTQ said I assumed you would be familiar and comfortable enough with adding functions since you'd seem to have done it before.
You could modify the function itself to straight echo out results but i thought writing it this way is a little more versatile in case later you'd like to do something with the results like manipulate the number etc.
Anyway as xGSTQ said you could paste this in your theme.php file for your theme or even in your mainfile.php or custom_mainfile for that matter.
To make things simple I would say paste it right before the closing PHP tag. ?>
Now in your footer.php (or theme.php if your footer function is echoed there) you would add the call function and echo as Raven pointed out. Do note I have modified the function slightly for you so as to not have to send the dbname when calling. So use the updated function instead. then where you want the table count to show add the following lines like so:
Code:echo "Total Tables in DB = ".tablecount();
|
|
|
|
|
 |
|