SA-MP Forums

Go Back   SA-MP Forums > Other > Everything and Nothing

Reply
 
Thread Tools Display Modes
Old 21/10/2013, 12:14 PM   #1
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,444
Reputation: 190
Default Site stats [PHP]

Ohai, i wanna show some stats about my website. I wanna show total registered members, total photos, total blogs and total blog posts. For each of them i have ALREADY a db table, i just need the code to show it.


//Total members
user_profiles

//Total photos
user_photos

//Total blogs
user_blogs

//Total blog posts
blog_posts

Now i need the code to read all this tables and show it like:

Registered members:
Photos uploaded:
Blogs:
Blogs posts:

How to?
Face9000 is offline   Reply With Quote
Old 21/10/2013, 01:17 PM   #3
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,444
Reputation: 190
Default Re: Site stats [PHP]

Thanks, i made it in this way:

Code:
$query="SELECT count(*) FROM `{$dbtable_prefix}user_profiles`";
if (!([email protected]_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$output['num_members']=mysql_result($res,0,0);
How to show it now in a html page?
Face9000 is offline   Reply With Quote
Old 21/10/2013, 01:39 PM   #4
ca2k
Huge Clucker
 
ca2k's Avatar
 
Join Date: Sep 2010
Posts: 348
Reputation: 106
Default Re: Site stats [PHP]

http://forums.phpfreaks.com/
__________________

pls Stop SprEAding eYe CanCer
ca2k is offline   Reply With Quote
Old 21/10/2013, 01:47 PM   #5
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,444
Reputation: 190
Default Re: Site stats [PHP]

I managed to show all the stats. I need it now to include the .php file (i created a php with all the code) in a html file.

Tried already "require" and "include", nothing.
Face9000 is offline   Reply With Quote
Old 21/10/2013, 03:10 PM   #6
[email protected]
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 3,036
Reputation: 1001
Default Re: Site stats [PHP]

You can't put php functions in a html file. Just change the html file to a php file.
__________________
Mah Github. - Mah Youtube
Interested in a full featured and cheap derby gamemode or need host-tab ? Contact me on skype: michael.belgium
Michael@Belgium is offline   Reply With Quote
Old 21/10/2013, 06:14 PM   #7
Pizzy
Huge Clucker
 
Join Date: May 2012
Posts: 469
Reputation: 113
Default Re: Site stats [PHP]

and you want to start a social networking site?

Good luck learning but honestly don't waste your time making a social networking site - don't invest a penny because it's not going to work, especially with your current knowledge.

It's good experience, but it's also quite advanced if you don't know the basics (as in showing data from a database in a PHP page).

But anyway good luck - just a bit of advice don't start making a social networking site and actually invest/promote it with the php skills you have - not worth the time or money!
__________________


Join the battle today.

play.samp-bf.net:7777

x2 EXP & CASH for all NEW players (first 20 minutes)
Pizzy is offline   Reply With Quote
Old 21/10/2013, 06:16 PM   #8
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,444
Reputation: 190
Default Re: Site stats [PHP]

Quote:
Originally Posted by [email protected] View Post
You can't put php functions in a html file. Just change the html file to a php file.
I can't change the html file in php since the html file handles all the text and shit.
Face9000 is offline   Reply With Quote
Old 21/10/2013, 06:22 PM   #9
Mauzen
Godfather
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 5,130
Reputation: 1556
Default Re: Site stats [PHP]

just rename it to whatever.php or modify your webserver config to treat html files as php scripts. Then use the
<?php
//Whatever code
?>
tag to insert php code where you need it. Everything else may stay plain html.
For something like social networking, php is the absolute top thing to know. You should at least know the very basics to learn the rest by trying it, else its gonna be a hard and annoying time.
Mauzen is offline   Reply With Quote
Old 21/10/2013, 06:40 PM   #10
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,352
Reputation: 822
Default Re: Site stats [PHP]

Quote:
Originally Posted by Mauzen View Post
just rename it to whatever.php or modify your webserver config to treat html files as php scripts. Then use the
<?php
//Whatever code
?>
tag to insert php code where you need it. Everything else may stay plain html.
For something like social networking, php is the absolute top thing to know. You should at least know the very basics to learn the rest by trying it, else its gonna be a hard and annoying time.
Or save it as (for example,if the file name is index.html) index.php(remember to include .php extension at the end of the name as this suffix will give it a recognition that this is a php file and has php code in it to compile),as alternative to renaming.
__________________
Kaperstone is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/stats command isnt updating the stats efrim123 Scripting Help 3 15/10/2013 09:40 AM
[Tool/Web/Other] [PHP/MySQL] Powerup Stats - Player stats signature generator kelvin22 Tools and Files 43 20/06/2013 11:15 PM
Team stats and XP stats in one Textdraw Design Sanady Screenshots and Videos 8 02/12/2012 12:10 PM
how to host your own videos on your site own site for free sherlock Everything and Nothing 3 17/09/2011 05:29 PM
Player stats displayed on site Snowman12 Help Archive 7 19/03/2011 10:02 AM


All times are GMT. The time now is 06:56 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.