diff --git a/botthread.c b/botthread.c index d11344c..b400ae1 100644 --- a/botthread.c +++ b/botthread.c @@ -315,15 +315,14 @@ res = dbQuery(output,1); - sprintf(output,"UPDATE videos SET count = %i WHERE vid = %i",atoi(row[6])+1,vid); - dbQuery(output,0); - if ((res == 0x0) || (mysql_num_rows(res) == 0x0)) { sprintf(output,"MSG:TUveD:%s:Sorry I'm Have SQL Troubles Today.",chan); tuveSendAllInChan(chan,0x0,output); } else { row = mysql_fetch_row(res); + sprintf(output,"UPDATE videos SET count = %i WHERE vid = %i",atoi(row[6])+1,vid); + dbQuery(output,0); tuveBotSetSong(chan,nick,row[0],row[1],atoi(row[3]),row[2],atoi(row[4]),atoi(row[5]),vid); } @@ -496,7 +495,7 @@ goto getComAgain; } else { - mysql_data_seek(res,(random() % mysql_num_row(res))); + mysql_data_seek(res,(random() % mysql_num_rows(res))); row = mysql_fetch_row(res); sprintf(output,"UPDATE videos SET count = %i WHERE vid = %s\n",atoi(row[7])+1,row[4]); dbQuery(output,0);