//unregister channel
printf_mysql_query("SELECT `botid`, `channel_name` FROM `bot_channels` LEFT JOIN `channels` ON `chanid` = `channel_id` WHERE `chanid` = '%s' AND `suspended` = '0'", row[1]);
res2 = mysql_use();
- while((row2 = mysql_fetch_row(res))) {
+ while((row2 = mysql_fetch_row(res2))) {
struct ClientSocket *bot;
int clientid = atoi(row2[0]);
for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) {