<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL: Insert if doesn&#8217;t exist otherwise update the existing row</title>
	<atom:link href="http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html</link>
	<description>Just another dumbass webmaster, goofing around...</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:57:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: peace</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-15505</link>
		<dc:creator>peace</dc:creator>
		<pubDate>Fri, 19 Aug 2011 08:07:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-15505</guid>
		<description>Thanks you so much. That&#039;s work great. Wonderful post and explanation.</description>
		<content:encoded><![CDATA[<p>Thanks you so much. That&#8217;s work great. Wonderful post and explanation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gustavo</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-15149</link>
		<dc:creator>gustavo</dc:creator>
		<pubDate>Wed, 04 May 2011 15:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-15149</guid>
		<description>nice way to do it, but it doesn&#039;t work when the id is present as a foreing key in another table. There&#039;s an error of restriction or even worst, a cascade elimination of registers in the foreing table. Take care of this point before try this command. Bye!</description>
		<content:encoded><![CDATA[<p>nice way to do it, but it doesn&#8217;t work when the id is present as a foreing key in another table. There&#8217;s an error of restriction or even worst, a cascade elimination of registers in the foreing table. Take care of this point before try this command. Bye!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kriss</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-15143</link>
		<dc:creator>kriss</dc:creator>
		<pubDate>Tue, 03 May 2011 20:00:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-15143</guid>
		<description>Thank you!</description>
		<content:encoded><![CDATA[<p>Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MySQL: Update Multiple Rows or Records with One Single Query</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-14337</link>
		<dc:creator>MySQL: Update Multiple Rows or Records with One Single Query</dc:creator>
		<pubDate>Thu, 17 Mar 2011 01:30:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-14337</guid>
		<description>[...] There&#8217;s also another way of doing this: http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html [...]</description>
		<content:encoded><![CDATA[<p>[...] There&#8217;s also another way of doing this: <a href="http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html" rel="nofollow">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rory P</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-10950</link>
		<dc:creator>Rory P</dc:creator>
		<pubDate>Fri, 10 Sep 2010 18:26:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-10950</guid>
		<description>Bingo bango! Thanks..</description>
		<content:encoded><![CDATA[<p>Bingo bango! Thanks..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Waples</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-10823</link>
		<dc:creator>James Waples</dc:creator>
		<pubDate>Thu, 02 Sep 2010 10:34:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-10823</guid>
		<description>X2 - the MySQL documentation gets quite confusing sometimes</description>
		<content:encoded><![CDATA[<p>X2 &#8211; the MySQL documentation gets quite confusing sometimes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: What Is My IP Address</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-10662</link>
		<dc:creator>What Is My IP Address</dc:creator>
		<pubDate>Fri, 13 Aug 2010 15:19:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-10662</guid>
		<description>Thank you so much .. you really saved my day since I was trying to avoid using SELECT, IF, UPDATE, INSERT query.

Thanks again!</description>
		<content:encoded><![CDATA[<p>Thank you so much .. you really saved my day since I was trying to avoid using SELECT, IF, UPDATE, INSERT query.</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: To Jon</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-9743</link>
		<dc:creator>To Jon</dc:creator>
		<pubDate>Mon, 05 Apr 2010 20:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-9743</guid>
		<description>Jo, you can create one more filed, with a md5key with the date and the ip.

example on php:
$ip = $_SERVER[&#039;remote_addr&#039;];
$today = date(&quot;Y-m-d&quot;);
$key = md5($ip.&quot;:&quot;.$today);

and the example:
REPLACE INTO table SET md5key= $key, foo = &#039;bar&#039;;

or

INSERT INTO table (a, b, c) VALUES ($key, 2, 3) ON DUPLICATE KEY UPDATE c = c + 1;</description>
		<content:encoded><![CDATA[<p>Jo, you can create one more filed, with a md5key with the date and the ip.</p>
<p>example on php:<br />
$ip = $_SERVER['remote_addr'];<br />
$today = date(&#8220;Y-m-d&#8221;);<br />
$key = md5($ip.&#8221;:&#8221;.$today);</p>
<p>and the example:<br />
REPLACE INTO table SET md5key= $key, foo = &#8216;bar&#8217;;</p>
<p>or</p>
<p>INSERT INTO table (a, b, c) VALUES ($key, 2, 3) ON DUPLICATE KEY UPDATE c = c + 1;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valter Henrique</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-8569</link>
		<dc:creator>Valter Henrique</dc:creator>
		<pubDate>Tue, 09 Mar 2010 12:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-8569</guid>
		<description>Thx dude, awesome, it really help me.</description>
		<content:encoded><![CDATA[<p>Thx dude, awesome, it really help me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-6255</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Mon, 21 Sep 2009 04:57:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-6255</guid>
		<description>how can I check for more than one field?

I would link to insert the field in case that 3 of its columns don&#039;t exist.

INSERT INTO TABLE (id,ip,date,rate) VALUES (NULL,&#039;111.333.222.444&#039;,now(),&#039;3&#039;)

However, I&#039;m checking not only for the Primary Key (which is an auto-increment anyways), but for fields &#039;ip&#039; and &#039;date&#039;. 

I need for an IP to be able to rate once per day.

Thanks!</description>
		<content:encoded><![CDATA[<p>how can I check for more than one field?</p>
<p>I would link to insert the field in case that 3 of its columns don&#8217;t exist.</p>
<p>INSERT INTO TABLE (id,ip,date,rate) VALUES (NULL,&#8217;111.333.222.444&#8242;,now(),&#8217;3&#8242;)</p>
<p>However, I&#8217;m checking not only for the Primary Key (which is an auto-increment anyways), but for fields &#8216;ip&#8217; and &#8216;date&#8217;. </p>
<p>I need for an IP to be able to rate once per day.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LED TV Tom</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-4990</link>
		<dc:creator>LED TV Tom</dc:creator>
		<pubDate>Thu, 03 Sep 2009 11:02:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-4990</guid>
		<description>Cheers for the article.  Always find the MySQL official documentation a bit heavy to read and understand.  Could understand this though :)</description>
		<content:encoded><![CDATA[<p>Cheers for the article.  Always find the MySQL official documentation a bit heavy to read and understand.  Could understand this though :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html/comment-page-1#comment-4445</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Tue, 04 Aug 2009 17:27:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.kavoir.com/2009/05/mysql-insert-if-doesnt-exist-otherwise-update-the-existing-row.html#comment-4445</guid>
		<description>Thanks for the article. It was exactly what I was looking for. You saved me a lot of time. I hope I can return the favor back to the community of developers soon. : )</description>
		<content:encoded><![CDATA[<p>Thanks for the article. It was exactly what I was looking for. You saved me a lot of time. I hope I can return the favor back to the community of developers soon. : )</p>
]]></content:encoded>
	</item>
</channel>
</rss>

