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:
le="color: #000000"><?php 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:
le="color: #000000"><?php 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

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!