proc getpost {} {
global db_handle posttimer
putlog "\[ #ns.pcw \] - Processing queue slot 1"
set que1 "SELECT * FROM posts ORDER BY thetime ASC LIMIT 1"
set newpost [mysqlsel $db_handle $que1 -flatlist]
foreach {id ircnick qauth thetime post} $newpost {
puthelp "PRIVMSG $::relay(adchan) :$id $ircnick $qauth $thetime $post"
}
set que2 "DELETE FROM posts WHERE id='$id'"
set result [mysqlexec $db_handle $que2]
puthelp "PRIVMSG $::relay(adchan) :Post \[ $id \] successfully copied and deleted."
set posttimer [utimer 30 getpost]
putlog "\[ #ns.pcw \] - getpost proc timer reset"
}
The proc will take a single line from the database, and then put it into an irc channel ($::relay(adchan)) then deletes it from the database - It works fine as long as there are rows in the table - however, if there isn't any thing in the table, then it has no definition for $id, so it gives an error and stops the proc...
so, need a re-write so it won't kill the loop if the table is empty....