Gossamer Forum
Home : Products : DBMan : Customization :

Counter mod

Quote Reply
Counter mod
Hi,
I searched for this mod several times but this discussion group got too big to find things efficently.
I am looking for the mod which counts how many records a user added to the database and return the number to him on the main menue.
Can anybody help ?
Quote Reply
Re: Counter mod In reply to
In sub html_home, add

Code:
$in{$db_cols[$auth_user_field]} = $db_userid;
my ($status, @hits) = &query("view");
unless ($db_total_hits) {
$db_total_hits = "0";
}

Wherever you want to print out the number of records the user has in the database, use $db_total_hits.



------------------
JPD






Quote Reply
Re: Counter mod In reply to
Did you look at the following Topic?

http://www.gossamer-threads.com/...m12/HTML/002625.html

It was added before you added your Topic.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Counter mod In reply to
As you are not looking for a counter but rather a way of calculating how many records an individual user has open you may find this thread helpful:

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001156.html

Please note that this thread is also talking about using this along with the relational mod so might be different for just one database.

Hope this helps Smile
Quote Reply
Re: Counter mod In reply to
Hi JP,
thank you for your code,

the question:
this only returns the value "0" but the user added already 3 records.
Can you fix this `?
Quote Reply
Re: Counter mod In reply to
Try adding the following line around where you put

$db_total_hits

(within a print statement)

Code:
Status = $status

Let me know what it says.


------------------
JPD






Quote Reply
Re: Counter mod In reply to
^Hi JP,

that's really curious:
Whne loged in as admin the database returns for the var:
$db_total_hits ---> 0
$status ---> no matching records.
if you log in as a normal user it returns
every time regardless how many record this user added
$db_total_hits ---> 1
$status ---> OK.
Quote Reply
Re: Counter mod In reply to
I'm assuming that you have a userid field set up in your .cfg file and that you have the field number entered in the $auth_user_field. Is that correct?



------------------
JPD






Quote Reply
Re: Counter mod In reply to
HI JP,

you are still working ?
Noop, the $auth_user_field is set to -1 and I cannot change it.
Quote Reply
Re: Counter mod In reply to
Why can't you change it?

Without an $auth_user_field, there is no way to tell which user added which record.


------------------
JPD