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

	<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>2006-05-11T18:26:55-04:00</updated>

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

		<entry>
		<author><name><![CDATA[T-Xorcist]]></name></author>
		<updated>2006-05-11T18:26:55-04:00</updated>

		<published>2006-05-11T18:26:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62945#p62945</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62945#p62945"/>
		<title type="html"><![CDATA[errh??]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62945#p62945"><![CDATA[
I try this:<div class="codebox"><p>Code: </p><pre><code>package require mysqltclset mysql(conn) [mysqlconnect -user user -db tbot -password pass]foreach name [mysqlsel $mysql(conn) "SELECT name FROM channels" -list] {  putquick "PRIVMSG $chan :$name "}mysqlclose $mysql(conn)</code></pre></div>There are 3 records in the database, but it only displays one, not all.<br>What am I doing wrong? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad"><br><br>Please help, I am trying 3 days now to get it done, but I just can't <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad"><br><br>I tried this aswell:<div class="codebox"><p>Code: </p><pre><code>set query1 [mysqlquery $mysql(conn) {SELECT name FROM channels}]while {[set row [mysqlnext $query1]]!=""} {  set name [lindex $row 0]  putquick "PRIVMSG $chan :$name"}mysqlendquery $query1</code></pre></div>Doesn't work either! Is it my mysqltcl maybe? I run FreeBSD by the way.<br><br><strong class="text-strong">It only displays the 1st record, not all 3</strong><br><br>Please help me <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> and let me know if the <strong class="text-strong">scripts</strong> are good.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6980">T-Xorcist</a> — Thu May 11, 2006 6:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2004-12-03T22:38:21-04:00</updated>

		<published>2004-12-03T22:38:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43420#p43420</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43420#p43420"/>
		<title type="html"><![CDATA[errh??]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43420#p43420"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set resultset [mysqlsel $mysql(conn) "SELECT nick FROM users ...]if {$resultset == {}} {# not found in db, register/insert follows#} else {# found in db, loop through result set  foreach result $resultset {  # use $result  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Dec 03, 2004 10:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[festiz]]></name></author>
		<updated>2004-12-03T18:57:15-04:00</updated>

		<published>2004-12-03T18:57:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=43416#p43416</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=43416#p43416"/>
		<title type="html"><![CDATA[errh??]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=43416#p43416"><![CDATA[
My problem is that my script won't enter my foreach-loop if there is no user with nick=$nick. Wich means that my if-statement is useless. Is there some way to transform my foreach to a combined if-statement that does what my if-statement should do? <br>In PHP i would have checked if number of results from the query is larger than zero, but I can't find a manualpage for mysqltcl that mentions this kind of function.<div class="codebox"><p>Code: </p><pre><code>foreach query [mysqlsel $mysql(conn) "SELECT nick FROM users WHERE nick='$nick' ORDER BY nick LIMIT 1" -list] {set test "[lindex $query 0]"if { $test eq "" } {set mysql(conn) [mysqlconnect -user $mysql(user) -password $mysql(pass) -db $mysql(data)]mysqlexec $mysql(conn) "INSERT INTO $mysql(table) ('nick' , 'uname') VALUES ('$nick','$uhost')"# SOME NICE OUTPUT THAT SAYS: This is how u register.} else {# SOME NICE OUTPUT THAT SAYS: You are already registered}}</code></pre></div>*Happy hugs* <br>Cut-n-paste-o-mania<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5728">festiz</a> — Fri Dec 03, 2004 6:57 pm</p><hr />
]]></content>
	</entry>
	</feed>
