• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Gesior ACC]How much vocation online TFS 1.2 PROBLEM

Sami_san

New Member
Joined
May 20, 2016
Messages
76
Reaction score
1
Hello there. Ive got a script for counting online vocations - ed - ms- ek -rp

Using tfs 1.2 so the error i get is
Query: SELECT COUNT(*) FROM `players` WHERE `vocation` = 1 OR `vocation` = 5 AND `online` = 1;
SQLSTATE: 42S22
Driver code: 1054
Error message: Unknown column 'online' in 'where clause'

as we see i aint got that column but how should i modify it to read how much is vocations online? thats my ONLINE LIST query for counting vocations Script

$sork = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `vocation` = 1 OR `vocation` = 5 AND `online` = 1;')->fetch();
$sork1 = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `vocation` = 2 OR `vocation` = 6 AND `online` = 1;')->fetch();
$sork2 = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `vocation` = 3 OR `vocation` = 7 AND `online` = 1;')->fetch();
$sork3 = $SQL->query('SELECT COUNT(*) FROM `players` WHERE `vocation` = 4 OR `vocation` = 8 AND `online` = 1;')->fetch();
 
The database schema for TFS 1.x is somewhat different compared to 0.3/0.4 where TFS 1.x does not have an 'online' column. If you want to check if a player is online, you'll have to include another table ('players_online') in your query as well, and check if player.id is equal to players_online.player_id.

Just a rough example to count sorcerers:
Code:
SELECT COUNT(0) FROM `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `players`.`vocation` IN (1, 5)
 
Back
Top