egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove {} brackets from Mysql output to chan [SOLVED]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Python
Voice


Joined: 21 May 2006
Posts: 2

PostPosted: Sun May 21, 2006 8:05 pm    Post subject: Remove {} brackets from Mysql output to chan [SOLVED] Reply with quote

Hi I'm making a script to fetch some data from my Mysql DB and putt it into a certain channel.

Im using eggdrop 1.6.17 with mysql.mod.

This is the script..

Code:
proc sql_gpcs03 { nick uhost handle channel arg } {
    global sql_channel
     if { $sql_channel == $channel } {
     mysql_connect database host user password
       set servinf [list]
       set servname [mysql_query "SELECT ServName FROM cv_server_details WHERE `SID` = 3"]
       set servip [mysql_query "SELECT IP FROM cv_server_list WHERE `SID` = 3"]
       set servport [mysql_query "SELECT PORT FROM cv_server_list WHERE `SID` = 3"]
        set servmap [mysql_query "SELECT ServMap FROM cv_server_details WHERE `SID` = 3"]
        set servclientscur [mysql_query "SELECT Clients_cur FROM cv_server_details WHERE `SID` = 3"]
       set servclientsmax [mysql_query "SELECT Clients_max FROM cv_server_details WHERE `SID` = 3"]
       set servinf [linsert $servinf end $servname $servip $servport $servmap $servclientscur $servclientsmax]
       putserv "PRIVMSG $channel : $servinf"
     mysql_close
     }
}

And this is the output:

(01:50:5Cool (gP|Python) !gpcs03
(01:51:00) (@gP|Contagion) {{{ gP.CS.03 [NL] - aim_ak-colt2k3}} } {{137.224.240.17} } {{27035} } {{aim_ak_colt2k3} } {{5} } {{14} }

I dont want those stupid {} brackets!

Im sure there's a simple solution for this, but it can't seem to find one with the search (or in any FAQ).
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Mon May 22, 2006 1:46 am    Post subject: Reply with quote

Use
Code:
join
to turn the lists into strings and you should just lappend the information, there is no point in using linsert and whatnot. Smile

edit: Why you use that many queries is beyond me, you should limit your queries by requesting multiple pieces of information with 1 query instead of 1 query for each piece of information.

(I prefer mysqltcl anyway)
Back to top
View user's profile Send private message
Python
Voice


Joined: 21 May 2006
Posts: 2

PostPosted: Mon May 22, 2006 8:23 am    Post subject: Reply with quote

Problem solved thnx to Metroid..

Lock?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber