<?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/18669" />

	<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>2011-10-19T01:08:41-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2011-10-19T01:08:41-04:00</updated>

		<published>2011-10-19T01:08:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97950#p97950</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97950#p97950"/>
		<title type="html"><![CDATA[Returning Results]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97950#p97950"><![CDATA[
Thanks nml375. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> I forgot to mention that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Oct 19, 2011 1:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[danwa]]></name></author>
		<updated>2011-10-18T07:46:01-04:00</updated>

		<published>2011-10-18T07:46:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97944#p97944</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97944#p97944"/>
		<title type="html"><![CDATA[Returning Results]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97944#p97944"><![CDATA[
Thanks for letting me know guys <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11812">danwa</a> — Tue Oct 18, 2011 7:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2011-10-18T03:23:15-04:00</updated>

		<published>2011-10-18T03:23:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97943#p97943</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97943#p97943"/>
		<title type="html"><![CDATA[Returning Results]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97943#p97943"><![CDATA[
The code posted by caesar is written for the <a href="http://www.xdobry.de/mysqltcl/" class="postlink">mysqltcl</a> tcl module, not BarkerJr's eggdrop module. Personally, I'd recommend the mysqltcl module as well, as it's a bit more flexible, and remains the same across other tcl-based applications.<br><br>That said, the problem with your script, is that you don't use the return-value of the mysql_query command:<div class="codebox"><p>Code: </p><pre><code>...mysql_query "select * from Residential where Phone1 = 'a'"..</code></pre></div>To store the result in a variable, use this:<div class="codebox"><p>Code: </p><pre><code>set result [mysql_query "select * from Residential where Phone1 = 'a'"]</code></pre></div>Now you can send the result to the channel, one record at a time:<div class="codebox"><p>Code: </p><pre><code>foreach item $result {  puthelp "PRIVMSG $c :Record: $item"## Or perhaps a little neater:# puthelp "PRIVMSG $c :Record: [join $item ", "]"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Oct 18, 2011 3:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2011-10-18T02:25:24-04:00</updated>

		<published>2011-10-18T02:25:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97942#p97942</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97942#p97942"/>
		<title type="html"><![CDATA[Returning Results]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97942#p97942"><![CDATA[
The script isn't working cos you forgot to fetch the results after you've queried the database. Don't know your database structure so I will fetch first 3 rows of the database and you should change this.<div class="codebox"><p>Code: </p><pre><code>set db(host) "localhost"set db(user) "user"set db(pass) "secret"set db(dbase) "search"bind pub -|- !mysqlquery mysqlproc mysql {nick uhost hand chan txt} {global dbset db_handle [mysqlconnect -host $db(host) -user $db(user) -password $db(pass) -db $db(dbase)]set results [mysqlquery $db_handle "SELECT * from Residential WHERE Phone1 = 'a'"]if {![moreresult $results]} {puthelp "PRIVMSG $chan :Couldn't find any matches."} else {puthelp "PRIVMSG $chan :Matches:"while {[set row [mysqlfetch $results]] != ''} {set row1 [lindex $row 0]set row2 [lindex $row 1]set row3 [lindex $row 2]puthelp "PRIVMSG $chan :row1: $row1, row2: $row2, row3: $row3"}mysqlendquery $results}mysqlclose $db_handle}</code></pre></div>Haven't tested this but in theory should work, if you change the database info and the rows. Let me know if it doesn't. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue Oct 18, 2011 2:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[danwa]]></name></author>
		<updated>2011-10-17T23:56:40-04:00</updated>

		<published>2011-10-17T23:56:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97941#p97941</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97941#p97941"/>
		<title type="html"><![CDATA[Returning Results]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97941#p97941"><![CDATA[
Using this in conjunction with the mysql eggdrop module<br><br><a href="http://www.barkerjr.net/eggdropmodules.html" class="postlink">http://www.barkerjr.net/eggdropmodules.html</a><br><a href="http://wiki.barkerjr.net/wiki/MySQL_Module#Tcl_Commands" class="postlink">http://wiki.barkerjr.net/wiki/MySQL_Module#Tcl_Commands</a><br><div class="codebox"><p>Code: </p><pre><code>proc mysql {n u h c a} {mysql_connect dbname dbhost dbuser dbpassmysql_query "select * from Residential WHERE Phone1 = 'a'"puthelp "PRIVMSG $c: $a"mysql_errno}bind pub -|- !mysqlquery mysql</code></pre></div>In the Table Residential there is a field named Phone1 that is populated in every row.<br><br>I can't get it to return anything, saying that, i'm not very confident with TCL.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11812">danwa</a> — Mon Oct 17, 2011 11:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
