Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Documentation
Author Message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1123

PostPosted: Wed Sep 30, 2009 4:21 pm Reply with quote

Does anyone know what is the code to get the numbers of tables from PHPmyadmin

I tried but it gives me 0

Shocked
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Wed Sep 30, 2009 5:11 pm Reply with quote

The number of queries or the number of tables?
 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Thu Oct 01, 2009 12:11 am Reply with quote

Yeah I wanna show the number of tables on the footer. Thanks in advance
 
hicuxunicorniobestbuildpc







PostPosted: Sat Oct 03, 2009 10:44 am Reply with quote

bump
 
xGSTQ
Involved
Involved



Joined: Feb 03, 2006
Posts: 269

PostPosted: Mon Oct 05, 2009 4:48 am Reply with quote

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
 
View user's profile Send private message Send e-mail
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Oct 05, 2009 7:38 am Reply with quote

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 
View user's profile Send private message
xGSTQ







PostPosted: Mon Oct 05, 2009 7:41 am Reply with quote

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







PostPosted: Mon Oct 05, 2009 8:43 am Reply with quote

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" Wink (corrected)
 
hicuxunicorniobestbuildpc







PostPosted: Mon Oct 05, 2009 11:43 am Reply with quote

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
Involved



Joined: Jul 03, 2006
Posts: 273

PostPosted: Mon Oct 05, 2009 1:22 pm Reply with quote

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 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Mon Oct 05, 2009 11:57 pm Reply with quote

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







PostPosted: Tue Oct 06, 2009 12:41 am Reply with quote

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







PostPosted: Tue Oct 06, 2009 1:58 am Reply with quote

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.
Shocked

How could be done if I wanna use it on footer instead of mainfile.php
 
xGSTQ







PostPosted: Tue Oct 06, 2009 2:24 am Reply with quote

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







PostPosted: Tue Oct 06, 2009 9:58 am Reply with quote

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();
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Documentation

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©