Version: , by Takara
Developer Last Online: Oct 2009
Version: Unknown
Rating:
Released: 06-08-2002
Last Update: Never
Installs: 0
No support by the author.
Im trying to use some stuff that FireFly did before to add the number of times a user made a new thread in a certin amount of forums (they work as columns).
Inside of members.php I added the following
PHP Code:
// get the total number of columns posted
$columns=$DB_site->query("SELECT postuserid,count(*) AS totalcolumns FROM thread WHERE forumid IN (25,26,27,28,29,30,31) AND postuserid = $userid GROUP BY postuserid");
if (!isset($columns[totalcolumns])) {
$total_columns="";
} else {
eval("\$total_columns = \"".gettemplate("column_total")."\";");
}
Thats near the bottem, then of course I have a template column_total, it simply reads
And then inside my getinfo template I put $total_columns right after the 'Total Posts:' part. Thing is, it always returns as not set (I know because I assigned a value where it says $total_columns=""; )
Im assuming the problem is that $userid isnt right, I also tried $user[userid]. How can I get the userid of the profile that is being requested?
Thanks :bunny:
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Hmm, well. $userid is right, I just made sure. So it must be my query then? But it works when I try it via mysql
Code:
mysql> SELECT postuserid,count(*) AS totalcolumns FROM thread WHERE forumid IN (25,26,27,28,29,30,31) AND postuserid = 4 GROUP BY postuserid -> ;
+------------+--------------+
| postuserid | totalcolumns |
+------------+--------------+
| 4 | 3 |
+------------+--------------+
1 row in set (0.00 sec)
mysql>
$columns=$DB_site->query_first("SELECT postuserid,count(*) AS totalcolumns FROM thread WHERE forumid IN (25,26,27,28,29,30,31) AND postuserid = $userid");
If I dont add the order by I get this icky error
Invalid SQL: SELECT postuserid,count(*) AS totalcolumns FROM thread WHERE forumid IN (25,26,27,28,29,30,31) AND postuserid = 4
mysql error: Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause
INSERT INTO setting (settingid,settinggroupid,title,varname,value,desc ription,optioncode,displayorde r) VALUES (NULL,26,'Admin Maximum Width','amw','100','Maximum width (in pixels) that the custom avatar image can be for admins.','','6')
INSERT INTO setting (settingid,settinggroupid,title,varname,value,desc ription,optioncode,displayorde r) VALUES (NULL,26,'Admin Maximum Height','amh','100','Maximum height (in pixels) that the custom avatar image can be for admins.','','6')
INSERT INTO setting (settingid,settinggroupid,title,varname,value,desc ription,optioncode,displayorde r) VALUES (NULL,26,'Admin Maximum File Size','amfs','20000','The maximum file size of admins (in bytes) that an avatar can be.','','6')
Hey firefly, I would seriously like to thank you for all your help. I'm usually able to code most of what I want to do, but my coding is always messy, and half the time I dont even know what I'm doing. You're always here when I need a little bit of my code corrected.