Problem - Channels order by points ts3 php

B2sv

Member
Mar 12, 2017
2
0
33
hello
i want to sort channels by points , sorting is ok in website but when i try to modify channels order i can't
i tried more than one method and all failed

my code

PHP:
$sql = $mysqlcon->query("SELECT * FROM $dbname.RoomsPoints ORDER BY points DESC");
$ChannelsArray = $sql->fetchAll();
foreach ( $ChannelsArray as $ke=>$channel ){
    echo $ts3_VirtualServer->channelGetById($channel['cid'])['channel_name'].'<br>';
    $change = array("channel_order" => $ts3_VirtualServer->channelGetById($channel['cid'])['channel_order'] );
    $ts3_VirtualServer->channelGetById($channel['cid'])->modify($change);
}

sry for my bad english :)
 

FarisDev

L oryh brx
Contributor
Jun 9, 2016
277
111
107
Welcome to R4P3, anyways I think the problem from "$dbname.RoomsPoints " Why you put .
 

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
Altho I never used the . in the SELECT statement I googled it and it should be fine, It means DB.TABLE :)
The problem is that you are trying to sort the channel behind the same channel which makes no sence.
Edit: You should move all channels to a temporary spacer/channel then start moving them one by one by your order so they sort the way you want. (Do it in reversed order so the last one is at the top)
 
Last edited:

B2sv

Member
Mar 12, 2017
2
0
33
thank you it's working , but i have a lot channels to move it :l
 

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
thank you it's working , but i have a lot channels to move it :l
Well it should be possible to move them without that tmp channel but i havent figured it out yet nor needed it.
 
Top