char protection;
loadChannelSettings(chan);
if(!(chan->flags & CHANFLAG_CHAN_REGISTERED)) return 0;
- printf_mysql_query("SELECT `channel_protect` FROM `channels` WHERE `channel_id` = '%d'");
+ printf_mysql_query("SELECT `channel_protect` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
res = mysql_use();
if(!(row = mysql_fetch_row(res))) return 0;
if(row[0]) {
protection = (char) atoi(row[0]);
} else {
- printf_mysql_query("SELECT `channel_protect` FROM `channels` WHERE `channel_name` = 'defaults'", chan->channel_id);
+ printf_mysql_query("SELECT `channel_protect` FROM `channels` WHERE `channel_name` = 'defaults'");
res = mysql_use();
row = mysql_fetch_row(res);
protection = (char) atoi(row[0]);