Code: Select all
set data [mysqlsel $handle "SELECT (data1) FROM my-db WHERE id = 1" -flatlist]
mysqlsel $handle "INSERT INTO my-other-db (foobar, data) VALUES ('foobar', '[lindex $data 0]')" -flatlist]
Code: Select all
mysqlsel $sql(handle) "INSERT INTO amx_banhistory(bhid,player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name,unban_created,unban_reason,unban_admin_nick) VALUES('bhid','0.0.0.0','player_id','player_nick','$host','admin_id','$nick','ban_type','$unban_unban_reason','$unban_ban_time','ban_length','$chan','IRC','$unban_unban_created','$unban_unban_reason','$nick');"
mysqlclose $sql(handle)
Code: Select all
set sma(qry) [mysqlsel $sql(handle) "SELECT bid,player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name FROM amx_bans WHERE player_id = '$arg' OR bid = '$arg'" -list]
if {$sma(qry) == ""} {
putserv "NOTICE $nick :No matches for '$arg'..."
return
}
mysqlsel $sql(handle) "INSERT INTO amx_banhistory (bid,player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name,unban_created,unban_reason,unban_admin_nick) VALUES('[lindex [split $sma(qry)] 0]' , '[lindex [split $sma(qry)] 1]' , '[lindex [split $sma(qry)] 2]' , '[lindex [split $sma(qry)] 3]' , '[lindex [split $sma(qry)] 4]' , '[lindex [split $sma(qry)] 5]' , '[lindex [split $sma(qry)] 6]' , '[lindex [split $sma(qry)] 7]' , '[lindex [split $sma(qry)] 8]' , '[lindex [split $sma(qry)] 9]' , '[lindex [split $sma(qry)] 10]' , '[lindex [split $sma(qry)] 11]' , '[lindex [split $sma(qry)] 12]' , '$unban_unban_created' , '$unban_unban_reason' , '$nick')"
mysqlclose $sql(handle)
putserv "NOTICE $nick :Done."
Code: Select all
string map { "\{" "" } ?var?
Code: Select all
string range ?var? 0 end-1
Code: Select all
string trimright ?var? }