Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
Thread Tools
  #1  
Old 21st October 2011, 23:36
FTWR FTWR is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 34
Default Count
I need a function to cleanup.php file to count how much uploaded torrents and forum posts have every user.

Quote:
$uploaded_torrents = mysql_query("SELECT COUNT(*) FROM torrents WHERE owner=" . $user["id"] ."") or print(mysql_error());
Quote:
$forum_posts = mysql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user['id']) or sqlerr();
Where is the mistake because the lines don't work.

P.S: I use Tbdev 2009!
Reply With Quote
  #2  
Old 22nd October 2011, 08:24
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
try it like so
PHP Code:
$uploaded_torrents mysql_query("SELECT COUNT(id) FROM torrents WHERE owner=" $user["id"] ."") or print(mysql_error()); 
PHP Code:
$forum_posts mysql_query("SELECT COUNT(id) FROM posts WHERE userid=" $user['id']) or sqlerr(); 
mysql don't like to count wild cards
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #3  
Old 22nd October 2011, 15:17
FTWR FTWR is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 34
Default
Don't work!

Quote:
Notice: Undefined variable: user in /home/admin/***/include/cleanup.php on line 153
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Notice: Undefined variable: user in /home/admin/***/include/cleanup.php on line 154
MySQL Error

There appears to be an error with the database.
You can try to refresh the page by clicking here.

Error Returned
Quote:
SQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SQL error code: 1064
Date: Saturday 22nd of October 2011 04:17:27 PM

Reply With Quote
  #4  
Old 22nd October 2011, 15:53
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
the query works you just gave me the wrong variable you need to fix $user['id']

Quote:
Notice: Undefined variable: user in /home/admin/***/include/cleanup.php on line 153
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #5  
Old 23rd October 2011, 09:08
FTWR FTWR is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 34
Default
The code is from userdetails.php. Do you think it work with that:

Quote:
$id = 0 + $_GET["id"];
Reply With Quote
  #6  
Old 23rd October 2011, 09:19
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
I would need to see the complete code to see what is going on and what your trying to do.
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #7  
Old 23rd October 2011, 11:34
FTWR FTWR is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 34
Default
Quote:
//Uploaded Torrents
$res3 = mysql_query("SELECT COUNT(*) FROM torrents WHERE owner=" . $user["id"] ."") or print(mysql_error());
$row2 = mysql_fetch_row($res3);
$uploaded_torrents = $row2[0];
//Forum Posts
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE userid=" . $user['id']) or sqlerr();
$arr3 = mysql_fetch_row($res);
$forumposts = $arr3[0];
.....
Reply With Quote
  #8  
Old 23rd October 2011, 15:50
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
are you trying to update for every user?
where is the $user["id"] part suppose to be coming from?
what are you doing with the information after you get it?
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #9  
Old 23rd October 2011, 19:37
FTWR FTWR is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 34
Default
Yes, for every user. With the information I will use it to promote at a new class (at a number of torrents).
Reply With Quote
Reply

Tags
count


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 01:49. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.