我试图仅在If语句的内容显示IF语句的内容时,当时它是返回所需值。但是,这行不通,所以我想这不是您在TCL中的做法。任何建议将不胜感激。
if {$firstq == 1} {
set sql "SELECT * FROM users WHERE username='$text' AND ircban='yes' LIMIT 1"
set result [mysqlsel $db_handle $sql]
if{$result == 1} {
putquick "NOTICE $nick :User is banned."
} elseif{$result == 0} {
putquick "NOTICE $nick :User is not banned."
}
您在elseif
之后缺少闭合支架,并且在if
和elseif
之后需要空格:
if {$firstq == 1} {
set sql "SELECT * FROM users WHERE username='$text' AND ircban='yes' LIMIT 1"
set result [mysqlsel $db_handle $sql]
if {$result == 1} { ;# <-- Need space after if
putquick "NOTICE $nick :User is banned."
} elseif {$result == 0} { ;# <-- Need space after elseif
putquick "NOTICE $nick :User is not banned."
} ;# <-- Missing closing brace
}