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

	<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-09-27T02:46:26-04:00</updated>

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

		<entry>
		<author><name><![CDATA[FossilAtrum]]></name></author>
		<updated>2006-09-27T02:46:26-04:00</updated>

		<published>2006-09-27T02:46:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66689#p66689</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66689#p66689"/>
		<title type="html"><![CDATA[stuck with tcl update query for mysql DB]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66689#p66689"><![CDATA[
flyingboabab, at first glance, it appears that your problem is with your sql-query, and not so much the rest of the code.<br><br>Rather try something like the following:<div class="codebox"><p>Code: </p><pre><code>  set text [mysqlescape $text]  set sql "REPLACE DELAYED prices SET price='$text' WHERE city ='NY' " </code></pre></div>I hope this helps.<br>FossilAtrum<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8237">FossilAtrum</a> — Wed Sep 27, 2006 2:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[flyingbaobab]]></name></author>
		<updated>2006-09-24T18:32:04-04:00</updated>

		<published>2006-09-24T18:32:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66655#p66655</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66655#p66655"/>
		<title type="html"><![CDATA[stuck with tcl update query for mysql DB]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66655#p66655"><![CDATA[
I'm working on a script that listens to 8 different commands (!pa int_valueA !pb int_valueB !pc int_valueC ...) that users put in a channel. The only thing that my scripts needs to do is add it to a mysql DB. The front-end is a php script that does some fancy stuff with the data.<br><br>My DB looks like<br><div class="codebox"><p>Code: </p><pre><code>TABLE `prices`id -&gt; int -&gt; auto increment - key price -&gt; intcity -&gt; varchartimestamp</code></pre></div>What works is adding each new entry in the #channel into mysql with following code<br><div class="codebox"><p>Code: </p><pre><code>proc pa { nick host handle channel text } {some basic checkingset sql "INSERT INTO prices VALUES(null, "  set text [mysqlescape $text]  append sql "'$text', "  append sql "'therightcity', "  append sql "'[clock seconds]')"  putloglev d * "Busy: executing $sql"  set result [mysqlexec $db_handle $sql]</code></pre></div>In fact I have 8 fixed values/records for the city-field. And since the price-field should be changed every 30m by user input, I was thinking its better to stick to my 8 records (instead of letting people add new database entries) and set a cronjob to reset the price field. (works fine, no problem this far).<br><br>What I want to achieve now, is that my tcl script updates the proper price for each city (based on the command input from a user) instead of adding a new DB entry. <br><br><span style="text-decoration:underline">Example:</span> <br><em class="text-italics">3h00, prices are being reset, db record for city New York looks like 1 - 0 - NY - 0<br>User types !pny 1234<br>Script should Update the proper record in the mysql db and it should look like 1 - 1234 - NY - unixtimestamp.</em><br><br>And this is where i have troubles: I've changed the above 'insert statement' to and update statement, but without any luck.<br>The modified code I tried to use was:<br> <div class="codebox"><p>Code: </p><pre><code>set sql "UPDATE prices SET (null, "  set text [mysqlescape $text]  append sql "'$text', "  append sql "'NY', "  append sql "'[clock seconds]') WHERE city ='NY'"</code></pre></div>This fails and I don't have the tcl skills to solve this one myself. Any advice would be welcome, since my research on the web didn't result in similar examples.<br><br>Thx in advance<br>FB<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8218">flyingbaobab</a> — Sun Sep 24, 2006 6:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
