Posts: 3,351
Threads: 780
Joined: Jan 2010
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?
Posts: 3,351
Threads: 780
Joined: Jan 2010
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?
Posts: 3,351
Threads: 780
Joined: Jan 2010
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.
Posts: 1,768
Threads: 91
Joined: Dec 2010
Reputation:
0
You can't put php functions in a html file. Just change the html file to a php file.
Posts: 355
Threads: 25
Joined: May 2012
Reputation:
0
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!
Posts: 3,351
Threads: 780
Joined: Jan 2010
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.
Posts: 4,878
Threads: 85
Joined: Jun 2007
Reputation:
0
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.
Posts: 3,004
Threads: 12
Joined: May 2011
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.