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

	<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-05-24T16:26:51-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-05-24T16:26:51-04:00</updated>

		<published>2007-05-24T16:26:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72959#p72959</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72959#p72959"/>
		<title type="html"><![CDATA[mysql query help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72959#p72959"><![CDATA[
Take a little look at these pieces from your code...<div class="codebox"><p>Code: </p><pre><code>set search [string map {" " "%"} [lindex $arg]]</code></pre></div><div class="codebox"><p>Code: </p><pre><code>  foreach result $query {   set nick [lindex $nick]   set Channel [lindex $Channel 2]   putquick "PRIVMSG $channel :SOURCE: $search from $nick - $Channel"  }</code></pre></div>First error, <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/lindex.htm" class="postlink">lindex</a> expects two arguments:<br>1. a list.<br>2. a number indicating which list item to fetch.<br>On several locations you've only supplied the first...<br><br>Secondly, there is no variable named Channel within your script, so trying to read $Channel would also generate an error.<br><br>Third, you never make any use of the variable result within your <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/foreach.htm" class="postlink">foreach</a>-loop, making it more or less pointless. I assume you intended to extract the nick and channel fields from the sql-query result? If so, you really should be using something like this:<div class="codebox"><p>Code: </p><pre><code>  foreach result $query {   set n [lindex $result 0]   set c [lindex $result 1]....</code></pre></div>And fourth, it would seem arg is not a tcl-list, and is thus not suitable to be used with lindex. You might considder <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/split.htm" class="postlink">split</a>ting it into a list first.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu May 24, 2007 4:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Frozen1985]]></name></author>
		<updated>2007-05-24T15:46:08-04:00</updated>

		<published>2007-05-24T15:46:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72956#p72956</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72956#p72956"/>
		<title type="html"><![CDATA[mysql query help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72956#p72956"><![CDATA[
ive been told to run an eggdrop for my friend. and i cant script it good. so thats why i ask here. problem is the last output to irc. i cant get the $nick and $channel to be outputted to the irc channel from the mysql db<br><blockquote class="uncited"><div>code:<br><br>bind pub "-|-" !from finduser<br><br>proc finduser {nick host handle channel arg} {<br><br><br><br>set dbhost "192.168.0.100"<br>set dbuser "xxx"<br>set dbpass "xxx"<br>set dbname "test"<br><br>set db_handle [mysqlconnect -host $dbhost -user $dbuser -password $dbpass]<br>mysqluse $db_handle $dbname<br><br>  if {$arg == ""} {<br>    return 0<br>  } else {<br><br> set search [string map {" " "%"} [lindex $arg]]<br> <br> set query [mysqlsel $db_handle "SELECT * FROM `HL2` WHERE `information` LIKE '$search' AND `nick` LIKE '%' AND `Channel` LIKE '%'" -list]<br> if {$query==""} { putquick "PRIVMSG $channel :$arg not found." ; return }<br><br>  foreach result $query {<br>  set nick [lindex $nick]<br>  set Channel [lindex $Channel 2]<br><br>  putquick "PRIVMSG $channel :SOURCE: $search from $nick - $Channel"<br>  }<br> }<br>} </div></blockquote><br><br>anyone who could assist me in this small script?<br>thanks for replys!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9017">Frozen1985</a> — Thu May 24, 2007 3:46 pm</p><hr />
]]></content>
	</entry>
	</feed>
