PDA

View Full Version : Small Hack


Logitech-2004
12-13-2003, 03:49 AM
How Do I List Diff Users Count On Main Page

Platinum Members: ?
Platinum+ Members: ?
Moderators: ?
Super Moderator: ?
Administrators: ?

How Do I Fill In The "?"'s

i know it's a templat edit, but what coding is required for it to work?

Dean C
12-13-2003, 09:11 AM
This requires more of a template edit. It requires code modications also.

Something like this in your index.php:


$platinum_usergroupid = 7;
$platinum_users = $DB_site->query_first("SELECT COUNT(*) AS total FROM user WHERE usergroupid='".invtal($platinum_usergroupid)."'");


A bit of modifcation of that code will do the trick :)

Logitech-2004
12-13-2003, 03:57 PM
Fatal error: Call to undefined function: invtal() in /var/www/html/platinum/index.php on line 16

Lesane
12-13-2003, 04:35 PM
Typo from mist, change invtal into intval

Logitech-2004
12-13-2003, 05:11 PM
Platinum+ Members: Array
ummm?

Neo
12-13-2003, 05:15 PM
$platinum_users[total]
$platinumplus_users[total]
$moderators[total]
etc

make sure you add the array name after the variable.

Logitech-2004
12-13-2003, 05:18 PM
Thanx Neo!!! Hey, U Want To Make That Hack For Me?

Logitech-2004
12-13-2003, 05:25 PM
$3M1=$DB_site->query_first("SELECT FROM 3MStatus WHERE 3M1");
$3M2=$DB_site->query_first("SELECT FROM 3MStatus WHERE 3M2");
$3M3=$DB_site->query_first("SELECT FROM 3MStatus WHERE 3M3");
$3M4=$DB_site->query_first("SELECT FROM 3MStatus WHERE 3M4");

Do You See Problem With This?

assassingod
12-13-2003, 05:32 PM
Yes, in the WHERE clause you arent setting a column. You need to use WHERE colname = '3m1' etc

(You have to change colname though)

Also, you aren't selecting anything. (If you want to select everything, use SELECT * )

Logitech-2004
12-13-2003, 05:39 PM
i have in my database

Table: 3MStstus
And Col's 3M1 3M2 3M3 3M4

Logitech-2004
12-13-2003, 05:42 PM
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /var/www/html/platinum/index.php on line 25

code
$3M1=$DB_site->query_first("SELECT * FROM '3MStatus' WHERE '3M1'");
$3M2=$DB_site->query_first("SELECT * FROM '3MStatus' WHERE '3M2'");
$3M3=$DB_site->query_first("SELECT * FROM '3MStatus' WHERE '3M3'");
$3M4=$DB_site->query_first("SELECT * FROM '3MStatus' WHERE '3M4'");

Logitech-2004
12-13-2003, 07:25 PM
any one????

Logitech-2004
12-13-2003, 07:26 PM
$M1=$DB_site->query_first("SELECT * FROM 3MStatus WHERE Index = 3M1");
$M2=$DB_site->query_first("SELECT * FROM 3MStatus WHERE Index = 3M2");
$M3=$DB_site->query_first("SELECT * FROM 3MStatus WHERE Index = 3M3");
$M4=$DB_site->query_first("SELECT * FROM 3MStatus WHERE Index = 3M4");

Still Get Errors
Database error in vBulletin 2.3.3:

Invalid SQL: SELECT * FROM 3MStatus WHERE Index = 3M1
mysql error: You have an error in your SQL syntax near 'Index = 3M1' at line 1

mysql error number: 1064

Logitech-2004
12-13-2003, 07:30 PM
$M1=$DB_site->query_first("SELECT * FROM 3MStatus WHERE 3M1 = '3M1'");
$M2=$DB_site->query_first("SELECT * FROM 3MStatus WHERE 3M2 = '3M2'");
$M3=$DB_site->query_first("SELECT * FROM 3MStatus WHERE 3M3 = '3M3'");
$M4=$DB_site->query_first("SELECT * FROM 3MStatus WHERE 3M4 = '3M4'");

This Dosen't Cause erros! But It Dosn't READ The Text Stored in the col's :(

Logitech-2004
12-13-2003, 08:46 PM
hummm i stumped them

Darkwaltz4
12-25-2003, 06:40 AM
$saved_array = $DB_site->query_first("SELECT col1,col2,col3 FROM table_name WHERE col1='value'");

firstly, this will grab the data in 'col1', 'col2', and 'col3' from the table called 'table_name'
where the col1 has the data 'value' in it. (wow, you can just read the query and get the same sentence as above ~_~)

however, the $saved_array contains the information similar to the query itself. it saves the data grabbed from each column, where col='value', and the keys of the var, are named based on the requested columns.

so, $saved_array[col1] would have the data that col1 had at col1='value'

~_~ okay, im starting to confuse myself(its a million times easier to do it yourself then explain how :-p), and i hope you arent further confused. maybe if you gave me all that your working with, i still dont know what it is your trying to do...