Site stats [PHP]
#1

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?
Reply
#2

Here you go : http://dev.mysql.com/doc/refman/5.0/...ting-rows.html
Reply
#3

Thanks, i made it in this way:

Код:
$query="SELECT count(*) FROM `{$dbtable_prefix}user_profiles`";
if (!($res=@mysql_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?
Reply
#4

http://forums.phpfreaks.com/
Reply
#5

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.
Reply
#6

You can't put php functions in a html file. Just change the html file to a php file.
Reply
#7

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!
Reply
#8

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
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.
Reply
#9

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.
Reply
#10

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)