PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

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

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: 16987
Location: Kansas

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

The number of queries or the number of tables?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

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

Yeah I wanna show the number of tables on the footer. Thanks in advance
View user's profile Send private message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

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

bump
View user's profile Send private message
xGSTQ
Involved
Involved


Joined: Feb 03, 2006
Posts: 267
Location: UK

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

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 Visit poster's website
Palbin
Site Admin


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

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

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?


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
Involved
Involved


Joined: Feb 03, 2006
Posts: 267
Location: UK

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

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


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

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

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


Joined: Aug 13, 2009
Posts: 432

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

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.

??
View user's profile Send private message
duck
Involved
Involved


Joined: Jul 03, 2006
Posts: 267

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

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
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

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

Thanks for your help duck but what u mean to call an echo, from where?


Last edited by unicornio on Tue Oct 06, 2009 2:03 am; edited 1 time in total
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

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

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);
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

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

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


Joined: Feb 03, 2006
Posts: 267
Location: UK

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

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
View user's profile Send private message Send e-mail Visit poster's website
duck
Involved
Involved


Joined: Jul 03, 2006
Posts: 267

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

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();
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum