1
showcase17
PHP script help please
  • 2009/8/7 23:43

  • showcase17

  • Not too shy to talk

  • Posts: 190

  • Since: 2005/1/6 0


I'd like to add a block which displays each users personal info like how many newsstories someone wrote, the number of images uploaded into an album and so on. This means if member A logs in, he should see his personal numbers / stats.

I've made a list with all totals (total number of newsstories, total number of images...) with this script:
echo"ONLINE "
$sql1 "SELECT * FROM ***_online";   
$query1 mysql_query($sql1);   
$num_rows mysql_num_rows($query1);   
echo 
"<strong>- " .$num_rows ."</strong> user(s) are NOW online";


The *** in $sql1 = "SELECT * FROM ***_online"; stands for the tableprefix name.

I'm a total noob to PHP so my question is: can someone please help me to a script which displays the personal stats please?
- To Explore and Discover -

2
ghia
Re: PHP script help please
  • 2009/8/8 8:43

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


For the user his personal counts, you have to lookup his count in the tables of the modules used on your site. Eg News:
if (is_object($xoopsUser
{
  
$uid =xoopsUser->getVar('uid');
  
$sql1 "SELECT count(*) FROM ***_xoops_stories where uid = $uid";   
  
$result mysql_query($sql1);   
  list(
$count) = fetchRow($result);
  echo 
"<strong>- " .$count ."</strong> articles";
}

Login

Username:
Password:

Lost Password? Register now!

Who's Online

83 user(s) are online (59 user(s) are browsing Support Forums)


Members: 1


Guests: 82


heyula,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits