View previous topic :: View next topic |
Author |
Message |
WashableMarker
Joined: 22 Dec 2003 Posts: 6
|
Posted: Mon Dec 22, 2003 5:16 am Post subject: List Total Posts? |
|
|
anybody got a hack to list the total posts in my blog? |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1005 Location: Washington
|
Posted: Tue Dec 30, 2003 9:09 pm Post subject: |
|
|
Code: |
function totalnumposts($userid) {
global $tableposts,$querycount;
$count = mysql_query("SELECT COUNT(ID) FROM $tableposts WHERE post_author = $userid");
$count = mysql_result($count, 0);
$querycount++;
echo $count;
}
|
Call it by...
Code: |
totalnumposts(your author ID);
|
_________________ Michael P. |
|
Back to top |
|
 |
jackiefg
Joined: 15 Oct 2003 Posts: 29 Location: Toronto, Ontario, Canada
|
Posted: Mon Jan 05, 2004 1:53 am Post subject: Sounds great |
|
|
Is there a way for me to make that into a link to a pop up window?
Like a link on the main page that says "Total post" or "All posts" and then you click and it pops up or even opens a new window?
Sorry I can't figure out how to make a link out of the php text
You won't believe it bought I have bought two books on php, I just don't find any simple explanations in either though. _________________ jackiefg |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1005 Location: Washington
|
Posted: Mon Jan 05, 2004 4:52 am Post subject: |
|
|
I don't see it feasible to have it opened in a separate window, because this function will only "echo" the total number of rows in a table. If you still want it, you only have to "include" b2config.php and b2functions.php files, then call "dbconnect" function to connect to the database. _________________ Michael P. |
|
Back to top |
|
 |
|