1

I'm trying to make display the contents of a if statement only if the if inside which is it, is returning the desired value. However this doesn't work, so I guess it's not how you do it in TCL. Any advice would be appreciated.

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."
}
Jerry
  • 70,495
  • 13
  • 100
  • 144

1 Answers1

5

You are missing a closing brace after the elseif and you need spaces after if and 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
}
Hai Vu
  • 37,849
  • 11
  • 66
  • 93