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

	<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-01-19T01:25:49-04:00</updated>

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

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2006-01-19T01:25:49-04:00</updated>

		<published>2006-01-19T01:25:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59530#p59530</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59530#p59530"/>
		<title type="html"><![CDATA[How to search a list of results from an sql query?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59530#p59530"><![CDATA[
build your result set as list of lists:<div class="codebox"><p>Code: </p><pre><code>...mysqlmap $db {id name score kills} {...lappend ::result [list $id $name $score $kills]...}</code></pre></div>then you'll be able to sort by index in sublist:<div class="codebox"><p>Code: </p><pre><code>proc foo {...} {...# sort by nameset ::result [lsort -index 1 $::result]...}</code></pre></div>refer to <a href="http://www.tcl.tk/man/tcl8.5/TclCmd/lsort.htm" class="postlink">lsort</a> manpage for more info and examples<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Thu Jan 19, 2006 1:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Reserve]]></name></author>
		<updated>2006-01-18T05:15:14-04:00</updated>

		<published>2006-01-18T05:15:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=59513#p59513</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=59513#p59513"/>
		<title type="html"><![CDATA[How to search a list of results from an sql query?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=59513#p59513"><![CDATA[
I’m trying to write a script that queries a database, sorts the results and then searches the results for a match.<br><br>The select query will be something like<br><div class="codebox"><p>Code: </p><pre><code> mysqlsel $mysql "SELECT * FROM sql_table where last_event &lt; $time" set mycount [mysqlresult $mysql rows?]  mysqlmap $mysql {id name score kills} { }</code></pre></div> <br> I have googled and searched the forum and found a few matches but I can’t get what I'm trying to do to work and don’t seem to be getting any error messages to help work out why it’s not working.<br><br>Once I have the results from the query I need to build a list of id, name, score and kills and sort first on score (DESC) and then on kills (DESC). That bit of the problem I can do with the actual select statement. The bit I'm having problems with is I need to somehow generate an index number for each result starting from 1 and ending with the last result to the query as follows<br><div class="codebox"><p>Code: </p><pre><code>  Index    name     score   kills  1        name1    100     20  2        name4    95      15  3        name2    82      10  4        name5    82      8  5        name3    60      5</code></pre></div>From this list I then need to do a search for a particular name and select that whole row but the important part of the row will be the index number for that row. I’ve seen references to lsearch and think this may be the way to do it but in not sure how to actually implement it.<br><br>Can anyone offer me any help or guidance with this script?<br><br>TIA<br><br>Regards<br><br>Reserve<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6109">Reserve</a> — Wed Jan 18, 2006 5:15 am</p><hr />
]]></content>
	</entry>
	</feed>
