If you just want that for the current PMs it is pretty simple.
For all PMs (sent and received):
[sql]select count(*) from PM where userid=1234[/sql]
For sent PMs
[sql]select count(*) from PM where userid=1234 and folderid=-1[/sql]
For received PMs
[sql]select count(*) from PM where userid=1234 and folderid!=-1[/sql]
If you want a real counter you would have to create a new int field in table user or userfield and increment that whenever the user receives or sends a pm.
|