Right, I've recently started a forum with a friend (football related) and its running vBulletin. We have an RSS system which automatically creates threads from RSS feeds. However, I want to be able to split these RSS feeds from the main stats of the site. From what I can tell (visiting vBulletin support forums etc) you cannot pull a single users post count from a variable. The RSS system increases the RSS Users post count artificially by running a little code. Now, if it runs that code each time to increment the users post count, I can add a line of code in there to increment a number stored in the SQL database. I've created a table called forum_rsscount and created a field in there called "count" and given it a number. How would I go about adding a number to this table in the above script? This is the code that artificially increments the "RSS FEEDER" account post count. - PHP: // update post count for user $posts = $vbulletin->db->query_first(" SELECT posts FROM " . TABLE_PREFIX . "user WHERE userid = ".$postuserid." "); $newpostcount = $posts['posts'] + 1; $vbulletin->db->free_result($posts); $vbulletin->db->query_write(" UPDATE " . TABLE_PREFIX . "user SET posts = ".$newpostcount." WHERE userid = ".$postuserid." "); So, what would I need to add in there to add a number to my forum_rsscount table, and do I need to make any changes to the table first? I.E Give it an ID? Thanks guys
Code: create table forum_rsscount ( userid int(8) not null, posts int(8) not null default 0, primary key(userid) ) Code: update forum_rsscount set posts = posts + 1 where userid = X
Thanks Simon, I've put the code in, just waiting for some new RSS feeds to come in so I can see if the table has updated
Works perfectly for me Code: simon@debian:~$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 to server version: 5.0.22-Debian_3 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database test -> ; Query OK, 1 row affected (0.01 sec) mysql> use test Database changed mysql> create table forum_rsscount ( -> userid int(8) not null, -> posts int(8) not null default 0, -> primary key(userid) -> ); Query OK, 0 rows affected (0.01 sec) mysql> insert into forum_rsscount(userid) values(123); Query OK, 1 row affected (0.00 sec) mysql> select * from forum_rsscount; +--------+-------+ | userid | posts | +--------+-------+ | 123 | 0 | +--------+-------+ 1 row in set (0.00 sec) mysql> update forum_rsscount set posts = posts + 1 where userid = 123; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from forum_rsscount; +--------+-------+ | userid | posts | +--------+-------+ | 123 | 1 | +--------+-------+ 1 row in set (0.00 sec) mysql>