<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13170" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-02-27T11:58:32-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13170</id>

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-02-27T11:58:32-04:00</updated>

		<published>2007-02-27T11:58:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70792#p70792</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70792#p70792"/>
		<title type="html"><![CDATA[help with code]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70792#p70792"><![CDATA[
If you do not provide an explicit return value using the "return" command, your proc will exit with the return value of the last successful command within the proc (not counting conditional constructs themselves).<br><br>Your code is however somewhat confusing; is $result a list of matching records, or is it the number of records returned?<br><div class="codebox"><p>Code: </p><pre><code>if {$result &gt; 0} {</code></pre></div>This suggests $result is the number of records returned from your query (being an integer).<br><div class="codebox"><p>Code: </p><pre><code>set username [lindex [split $result] 0]</code></pre></div>This however suggests that $result is a resultset from your query, with each field being whitespace separated (ie. not a proper tcllist). I am not familiar with the -list parameter for mysqlsel, but from what I can tell from resources on the net, it makes mysqlsel return a list of lists. Hence, split should <strong class="text-strong">NOT</strong> be used here.<br><br>From the bits and pieces I've managed to gather from your script and mysqltcl, I guess you should have something like this:<div class="codebox"><p>Code: </p><pre><code>proc invite_me { nick host handle text } { global db_handle staffchan set sql "SELECT username, irc FROM users WHERE username='$nick'" set result [mysqlsel $db_handle $sql -list] if {[llength $result] &gt; 0} {  set username [lindex [lindex $result 0] 0]  set password [lindex [lindex $result 0] 1]  } ....}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Feb 27, 2007 11:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Wayno]]></name></author>
		<updated>2007-02-27T09:07:36-04:00</updated>

		<published>2007-02-27T09:07:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=70781#p70781</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=70781#p70781"/>
		<title type="html"><![CDATA[help with code]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=70781#p70781"><![CDATA[
hi i have writen some code and it returns with { and } at the ends and i would like to remvoe them how todo it?<br><div class="codebox"><p>Code: </p><pre><code>proc invite_me { nick host handle text } {    global db_handle staffchan      set sql "SELECT username, irc FROM users WHERE username='$nick'"      set result [mysqlsel $db_handle $sql -list]        if {$result &gt; 0} {            set username [lindex [split $result] 0]            set password [lindex [split $result] 1] </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7606">Wayno</a> — Tue Feb 27, 2007 9:07 am</p><hr />
]]></content>
	</entry>
	</feed>
