<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Loogaroo : Lamp / web 2.0 / Ajax ... &#187; MySQL</title>
	<atom:link href="http://loogaroo.net/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://loogaroo.net</link>
	<description></description>
	<lastBuildDate>Tue, 14 Jul 2009 17:48:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mysql / mysqli / mysqlnd : les extensions PHP pour MySQL</title>
		<link>http://loogaroo.net/2007/10/01/mysql-mysqli-mysqlnd-les-extensions-php-pour-mysql/</link>
		<comments>http://loogaroo.net/2007/10/01/mysql-mysqli-mysqlnd-les-extensions-php-pour-mysql/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 17:46:33 +0000</pubDate>
		<dc:creator>Manu</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://loogaroo.net/2007/10/01/mysql-mysqli-mysqlnd-les-extensions-php-pour-mysql/</guid>
		<description><![CDATA[Le couple PHP / MySQL est devenu inséparable depuis quelques années maintenant&#8230; Mais la vie de couple n&#8217;est pas toujours facile. Il existe 3 façons d&#8217;unir ce couple :

ext/mysql : l&#8217;extension mysql classique (old school) que nous avons tous utilisés
ext/mysqli : l&#8217;extension mysql &#8220;improved&#8221; (sous entendu amélioré) interface object  / prepared statement et autres [...]]]></description>
			<content:encoded><![CDATA[<p>Le couple PHP / MySQL est devenu inséparable depuis quelques années maintenant&#8230; Mais la vie de couple n&#8217;est pas toujours facile. Il existe 3 façons d&#8217;unir ce couple :</p>
<ul>
<li><a href="http://fr.php.net/mysql">ext/mysql</a> : l&#8217;extension mysql classique (old school) que nous avons tous utilisés</li>
<li><a href="http://fr.php.net/mysqli">ext/mysqli </a>: l&#8217;extension mysql &#8220;improved&#8221; (sous entendu amélioré) interface object  / prepared statement et autres nouveautés</li>
</ul>
<p>Mais voilà, le hic c&#8217;est les fameuses connexions persistentes, depuis toujours on a tous désactiver cette possibilité allant même jusqu&#8217;à oublier qu&#8217;elle existait.</p>
<p>Mais voila MySQL AB a décidé de prendre le taureau par les cornes et de développer une libriairie de remplacement pour résoudre ces problèmes. c&#8217;est chose faite avec mysqlnd (Mysql native driver). cette librairies remplace la librairie libmysql qui se trouve dans PHP et elle est écrit directement par les équipes de MySQL.</p>
<p><a href="http://dev.mysql.com/downloads/connector/php-mysqlnd/">pour en savoir plus </a></p>
<p>A tester !</p>

<div class="sociable">
<span class="sociable_tagline">
<strong>Partager et découvrir :</strong>
	<span>Ces icônes sont des liens vers des sites de partage de signet sociaux où les lecteurs peuvent partager et découvrir de nouveaux liens.</span>
</span>
<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;title=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL" title="bodytext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/digg.png" title="bodytext" alt="bodytext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;title=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL" title="del.icio.us"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;title=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL&amp;popup=no" title="Netvouz"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;title=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL" title="description"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.thisnext.com/pick/new/submit/sociable/?url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;name=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL" title="ThisNext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/thisnext.png" title="ThisNext" alt="ThisNext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;bm_description=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL&amp;plugin=soc" title="MisterWong"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/misterwong.gif" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://wists.com/s.php?c=&amp;r=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;title=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL" title="Wists"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wists.png" title="Wists" alt="Wists" class="sociable-hovers sociable_wists" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F&amp;title=mysql%20%2F%20mysqli%20%2F%20mysqlnd%20%3A%20les%20extensions%20PHP%20pour%20MySQL" title="Scoopeo"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/scoopeo.png" title="Scoopeo" alt="Scoopeo" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F" title="Technorati"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.wikio.com/vote?url=http%3A%2F%2Floogaroo.net%2F2007%2F10%2F01%2Fmysql-mysqli-mysqlnd-les-extensions-php-pour-mysql%2F" title="Wikio"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wikio.gif" title="Wikio" alt="Wikio" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loogaroo.net/2007/10/01/mysql-mysqli-mysqlnd-les-extensions-php-pour-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Créer une table temporaire</title>
		<link>http://loogaroo.net/2007/09/18/creer-une-table-temporaire/</link>
		<comments>http://loogaroo.net/2007/09/18/creer-une-table-temporaire/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 17:51:55 +0000</pubDate>
		<dc:creator>Manu</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[optimisation]]></category>

		<guid isPermaLink="false">http://loogaroo.net/2007/09/18/creer-une-table-temporaire/</guid>
		<description><![CDATA[Parfois, il est préférable ou nécessaire de passer par une table temporaire pour insérer / mettre a jour des données.
Ca vous permet d&#8217;insérer les données et eventuellement de vérifier la table temporaire avant de permutter les 2 tables.
Par exemple, vérifier que votre table comporte au moins 10 éléments ou n&#8217;est pas vide.
&#160;
//j'efface la table temporaire [...]]]></description>
			<content:encoded><![CDATA[<p>Parfois, il est préférable ou nécessaire de passer par une table temporaire pour insérer / mettre a jour des données.<br />
Ca vous permet d&#8217;insérer les données et eventuellement de vérifier la table temporaire avant de permutter les 2 tables.<br />
Par exemple, vérifier que votre table comporte au moins 10 éléments ou n&#8217;est pas vide.</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="php" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//j'efface la table temporaire si elle existe :</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$res</span>=<a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;drop table if exists my_table_tmp&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$res</span>==<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Erreur mysql &quot;</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//je récupére la structure de la table maitre</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$res</span>=<a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;show create table my_table&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$res</span>==<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Erreur mysql &quot;</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$row</span>=<a href="http://www.php.net/mysql_fetch_row"><span style="color: #000066;">mysql_fetch_row</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$create</span>=<span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//je substitue le nom de ma table maitre pour créer ma table temporaire</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$create</span>=<a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;my_table&quot;</span>,<span style="color: #ff0000;">&quot;my_table_tmp&quot;</span>,<span style="color: #0000ff;">$create</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//je crée ma table temporaire.</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$res</span>=<a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$create</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Erreur mysql &quot;</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></div></div>
<p>La requete utilisant <a href="http://dev.mysql.com/doc/refman/5.0/fr/rename-table.html">RENAME TABLE</a> est pratique pour ce cas :</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="sql" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TABLE</span> my_table <span style="color: #993333; font-weight: bold;">TO</span> my_table_backup, my_table_tmp <span style="color: #993333; font-weight: bold;">TO</span> my_table;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></div></div>
<p>en PHP ca donne :</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="php" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//Je permutte les tables</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$res</span>=<a href="http://www.php.net/mysql_query"><span style="color: #000066;">mysql_query</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;RENAME TABLE my_table TO my_table_backup, my_table_tmp TO my_table&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Erreur mysql &quot;</span>.<a href="http://www.php.net/mysql_error"><span style="color: #000066;">mysql_error</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></div></div>

<div class="sociable">
<span class="sociable_tagline">
<strong>Partager et découvrir :</strong>
	<span>Ces icônes sont des liens vers des sites de partage de signet sociaux où les lecteurs peuvent partager et découvrir de nouveaux liens.</span>
</span>
<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;title=Cr%C3%A9er%20une%20table%20temporaire" title="bodytext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/digg.png" title="bodytext" alt="bodytext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;title=Cr%C3%A9er%20une%20table%20temporaire" title="del.icio.us"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;title=Cr%C3%A9er%20une%20table%20temporaire&amp;popup=no" title="Netvouz"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;title=Cr%C3%A9er%20une%20table%20temporaire" title="description"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.thisnext.com/pick/new/submit/sociable/?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;name=Cr%C3%A9er%20une%20table%20temporaire" title="ThisNext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/thisnext.png" title="ThisNext" alt="ThisNext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;bm_description=Cr%C3%A9er%20une%20table%20temporaire&amp;plugin=soc" title="MisterWong"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/misterwong.gif" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://wists.com/s.php?c=&amp;r=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;title=Cr%C3%A9er%20une%20table%20temporaire" title="Wists"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wists.png" title="Wists" alt="Wists" class="sociable-hovers sociable_wists" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F&amp;title=Cr%C3%A9er%20une%20table%20temporaire" title="Scoopeo"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/scoopeo.png" title="Scoopeo" alt="Scoopeo" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F" title="Technorati"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.wikio.com/vote?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F18%2Fcreer-une-table-temporaire%2F" title="Wikio"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wikio.gif" title="Wikio" alt="Wikio" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loogaroo.net/2007/09/18/creer-une-table-temporaire/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL : testez le retour de mysql_connect, ou de mysqli-&gt;connect</title>
		<link>http://loogaroo.net/2007/09/17/mysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect/</link>
		<comments>http://loogaroo.net/2007/09/17/mysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 20:23:40 +0000</pubDate>
		<dc:creator>Manu</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Mysql Error Stop]]></category>
		<category><![CDATA[evangélisation]]></category>

		<guid isPermaLink="false">http://loogaroo.net/2007/09/17/mysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect/</guid>
		<description><![CDATA[Je reviens sur un problème qui m&#8217;a sauté aux yeux la semaine dernière, en effet en interrogeant Google on remarque que 797 000 pages (734 000 la semaine dernière) contiennent une erreur PHP car tout le monde pense que le serveur MySQL tourne toujours.. La preuve que non&#8230;
Je lance une grand campagne auprès de tous [...]]]></description>
			<content:encoded><![CDATA[<p>Je reviens sur un problème qui m&#8217;a sauté aux yeux la semaine dernière, en effet en interrogeant Google on remarque que 797 000 pages (734 000 la semaine dernière) contiennent une erreur PHP car tout le monde pense que le serveur MySQL tourne toujours.. La preuve que non&#8230;</p>
<p>Je lance une grand campagne auprès de tous les webmasters PHP pour réduire ce nombre</p>
<p>Les news sur ce point seront disponible dans la catégorie <a href="http://loogaroo.net/category/mysql-error-stop/">MySQL Error Stop</a></p>
<p>Unissons nous pour faire reculer le fléau.</p>

<div class="sociable">
<span class="sociable_tagline">
<strong>Partager et découvrir :</strong>
	<span>Ces icônes sont des liens vers des sites de partage de signet sociaux où les lecteurs peuvent partager et découvrir de nouveaux liens.</span>
</span>
<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;title=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect" title="bodytext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/digg.png" title="bodytext" alt="bodytext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;title=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect" title="del.icio.us"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;title=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect&amp;popup=no" title="Netvouz"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;title=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect" title="description"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.thisnext.com/pick/new/submit/sociable/?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;name=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect" title="ThisNext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/thisnext.png" title="ThisNext" alt="ThisNext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;bm_description=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect&amp;plugin=soc" title="MisterWong"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/misterwong.gif" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://wists.com/s.php?c=&amp;r=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;title=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect" title="Wists"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wists.png" title="Wists" alt="Wists" class="sociable-hovers sociable_wists" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F&amp;title=MySQL%20%3A%20testez%20le%20retour%20de%20mysql_connect%2C%20ou%20de%20mysqli-%3Econnect" title="Scoopeo"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/scoopeo.png" title="Scoopeo" alt="Scoopeo" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F" title="Technorati"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.wikio.com/vote?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F17%2Fmysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect%2F" title="Wikio"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wikio.gif" title="Wikio" alt="Wikio" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loogaroo.net/2007/09/17/mysql-testez-le-retour-de-mysql_connect-ou-de-mysqli-connect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>N&#8217;oublie pas l&#8217;indexation</title>
		<link>http://loogaroo.net/2007/09/14/noublie-pas-lindexation/</link>
		<comments>http://loogaroo.net/2007/09/14/noublie-pas-lindexation/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 12:20:08 +0000</pubDate>
		<dc:creator>Manu</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[haute disponibilité]]></category>
		<category><![CDATA[optimisation]]></category>

		<guid isPermaLink="false">http://loogaroo.net/2007/09/14/noublie-pas-lindexation/</guid>
		<description><![CDATA[Une notion que certains développeurs oublient parfois et une erreur de débutant que je vois régulièrement dans des scripts open source. Je vais prendre l&#8217;exemple (simplié a l&#8217;extrème) d&#8217;un blog avec des articles et des categories. J&#8217;ai une table avec un champ texte qui contient le texte de mon article, un identifiant (clé primaire) de [...]]]></description>
			<content:encoded><![CDATA[<p>Une notion que certains développeurs oublient parfois et une erreur de débutant que je vois régulièrement dans des scripts open source. Je vais prendre l&#8217;exemple (simplié a l&#8217;extrème) d&#8217;un blog avec des articles et des categories. J&#8217;ai une table avec un champ texte qui contient le texte de mon article, un identifiant (clé primaire) de l&#8217;article et une catégorie pour classer l&#8217;article (sous forme d&#8217;entier).</p>
<p>La création de la table donne ca :</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="mysql" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE TABLE</span> `test_index` <span style="color: #66cc66;">&#40;</span>`id` <span style="color: #aa9933; font-weight: bold;">INT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> ,`texte` <span style="color: #aa9933; font-weight: bold;">TEXT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> ,`categorie` <span style="color: #aa9933; font-weight: bold;">INT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span> ,<span style="color: #993333; font-weight: bold;">PRIMARY KEY</span> <span style="color: #66cc66;">&#40;</span> `id` <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> ENGINE = MYISAM ;</div></li></ol></div></div>
<p>Tout va bien la plupart du temps mais quand la base commence a prendre du volume, certaines pages deviennent lentes. Dans notre cas, il s&#8217;agit de la page par categorie, c&#8217;est à dire la page qui regroupe tous les articles d&#8217;une même categorie.</p>
<p>La raison de cette lenteur est simple, MySQL est obligé de parcourir toute la table pour extraire les articles de la catégorie désirée.</p>
<p>Il faut donc ajouter un index sur le champ categorie pour accélérer les requetes du type</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="mysql" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> test_index <span style="color: #993333; font-weight: bold;">WHERE</span> categorie=<span style="color: #ff0000;">'1'</span>;</div></li></ol></div></div>
<p>Comment ajouter un index avec une commande MySQL :</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="mysql" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ALTER TABLE</span> `test_index` ADD INDEX <span style="color: #66cc66;">&#40;</span> `categorie` <span style="color: #66cc66;">&#41;</span></div></li></ol></div></div>
<p>Comment ajouter un index avec PHPMyAdmin :</p>
<p>1. Je choisis ma table</p>
<p>2. je vais dans le menu Structure</p>
<p><img src="http://loogaroo.net/wp-content/uploads/2007/09/phpmyadmin_index1.png" /></p>
<p>3. Je clique sur créer 1 index :</p>
<p><img src="http://loogaroo.net/wp-content/uploads/2007/09/phpmyadmin_index2.png" /></p>
<p>4. Je choisis &#8220;categorie&#8221; comme champ sur lequel je crée l&#8217;index.</p>
<p><img src="http://loogaroo.net/wp-content/uploads/2007/09/phpmyadmin_index3.png" /></p>
<p>5. Je clique sur Save pour enregistrer</p>
<p><img src="http://loogaroo.net/wp-content/uploads/2007/09/phpmyadmin_index4.png" /></p>
<p>6. Je vois la requete de création de l&#8217;index</p>
<p><img src="http://loogaroo.net/wp-content/uploads/2007/09/phpmyadmin_index5.png" /></p>
<p>7. mon index est affiché parmis la liste des index</p>
<p><img src="http://loogaroo.net/wp-content/uploads/2007/09/phpmyadmin_index6.png" /></p>
<p>Toutes mes requètes possibles sont optimisés :</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="mysql" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> test_index <span style="color: #993333; font-weight: bold;">WHERE</span> id=<span style="color: #ff0000;">'2'</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> test_index <span style="color: #993333; font-weight: bold;">WHERE</span> categorie=<span style="color: #ff0000;">'6'</span>;</div></li></ol></div></div>
<p>Dernière remarque : il n&#8217;est jamais trop tard pour créer un index ! la création sera peut-être un peu plus longue que sur une table vide mais ce n&#8217;est pas interdit<br />
<em><strong>&#8220;Il n&#8217;est jamais trop tard pour bien faire&#8221;</strong></em></p>

<div class="sociable">
<span class="sociable_tagline">
<strong>Partager et découvrir :</strong>
	<span>Ces icônes sont des liens vers des sites de partage de signet sociaux où les lecteurs peuvent partager et découvrir de nouveaux liens.</span>
</span>
<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;title=N%27oublie%20pas%20l%27indexation" title="bodytext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/digg.png" title="bodytext" alt="bodytext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;title=N%27oublie%20pas%20l%27indexation" title="del.icio.us"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;title=N%27oublie%20pas%20l%27indexation&amp;popup=no" title="Netvouz"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;title=N%27oublie%20pas%20l%27indexation" title="description"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.thisnext.com/pick/new/submit/sociable/?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;name=N%27oublie%20pas%20l%27indexation" title="ThisNext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/thisnext.png" title="ThisNext" alt="ThisNext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;bm_description=N%27oublie%20pas%20l%27indexation&amp;plugin=soc" title="MisterWong"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/misterwong.gif" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://wists.com/s.php?c=&amp;r=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;title=N%27oublie%20pas%20l%27indexation" title="Wists"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wists.png" title="Wists" alt="Wists" class="sociable-hovers sociable_wists" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F&amp;title=N%27oublie%20pas%20l%27indexation" title="Scoopeo"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/scoopeo.png" title="Scoopeo" alt="Scoopeo" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F" title="Technorati"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.wikio.com/vote?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F14%2Fnoublie-pas-lindexation%2F" title="Wikio"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wikio.gif" title="Wikio" alt="Wikio" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loogaroo.net/2007/09/14/noublie-pas-lindexation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Et si MySQL était mort ?</title>
		<link>http://loogaroo.net/2007/09/13/et-si-mysql-etait-mort/</link>
		<comments>http://loogaroo.net/2007/09/13/et-si-mysql-etait-mort/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 19:35:25 +0000</pubDate>
		<dc:creator>Manu</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Mysql Error Stop]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[trucs et astuces]]></category>

		<guid isPermaLink="false">http://loogaroo.net/2007/09/13/et-si-mysql-etait-mort/</guid>
		<description><![CDATA[Une chose assez importante auquel les développeurs ne pensent pas tout le temps : Avez vous verifié si votre serveur MySQL fonctionne correctement ? Est-ce que la fonction mysql_connect / mysqli_connect ne renvoit pas false ?
Je pense que beaucoup oublie cet étape, c&#8217;est comprehensible dans l&#8217;euphorie du développement. J&#8217;ai fait une petite requète sur Google [...]]]></description>
			<content:encoded><![CDATA[<p>Une chose assez importante auquel les développeurs ne pensent pas tout le temps : Avez vous verifié si votre serveur MySQL fonctionne correctement ? Est-ce que la fonction mysql_connect / mysqli_connect ne renvoit pas false ?</p>
<p>Je pense que beaucoup oublie cet étape, c&#8217;est comprehensible dans l&#8217;euphorie du développement. J&#8217;ai fait une petite requète sur <a href="http://www.google.fr/search?num=100&amp;hl=fr&amp;client=firefox-a&amp;rls=com.ubuntu%3Aen-US%3Aofficial&amp;hs=mQ1&amp;q=%22supplied+argument+is+not+a+valid+MySQL-Link%22&amp;btnG=Rechercher&amp;meta=">Google</a>  et je vois tout simplement 734000 pages avec une erreur qui découle de ce problème&#8230;</p>
<p>C&#8217;est pas bien compliqué, il faut juste y penser !</p>
<div style="overflow: auto; width: 450px;padding-bottom: 15px;"><div class="php" style="color: #000066; border-left: 5px solid rgb(195, 215, 234); background-color: rgb(240, 240, 240); padding:1px;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$my</span>=<a href="http://www.php.net/mysql_connect"><span style="color: #000066;">mysql_connect</span></a><span style="color: #66cc66;">&#40;</span>...,...,...<span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$my</span>===<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/header"><span style="color: #000066;">header</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;location: /mysql_out.php&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// a la rigueur on envoie un petit mail au webmaster pour le mettre au courant</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/mail"><span style="color: #000066;">mail</span></a><span style="color: #66cc66;">&#40;</span>...,...,...,...<span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;font: normal normal 8pt 'Courier New', Courier, monospace; color: #003030;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></div></div>
<p>Allez je referai un petit point de temps en temps pour voir si ce nombre (734 000 pages sur Google) baisse un peu !</p>

<div class="sociable">
<span class="sociable_tagline">
<strong>Partager et découvrir :</strong>
	<span>Ces icônes sont des liens vers des sites de partage de signet sociaux où les lecteurs peuvent partager et découvrir de nouveaux liens.</span>
</span>
<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;title=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F" title="bodytext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/digg.png" title="bodytext" alt="bodytext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;title=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F" title="del.icio.us"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;title=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F&amp;popup=no" title="Netvouz"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;title=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F" title="description"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.thisnext.com/pick/new/submit/sociable/?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;name=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F" title="ThisNext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/thisnext.png" title="ThisNext" alt="ThisNext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;bm_description=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F&amp;plugin=soc" title="MisterWong"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/misterwong.gif" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://wists.com/s.php?c=&amp;r=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;title=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F" title="Wists"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wists.png" title="Wists" alt="Wists" class="sociable-hovers sociable_wists" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F&amp;title=Et%20si%20MySQL%20%C3%A9tait%20mort%20%3F" title="Scoopeo"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/scoopeo.png" title="Scoopeo" alt="Scoopeo" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F" title="Technorati"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.wikio.com/vote?url=http%3A%2F%2Floogaroo.net%2F2007%2F09%2F13%2Fet-si-mysql-etait-mort%2F" title="Wikio"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wikio.gif" title="Wikio" alt="Wikio" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loogaroo.net/2007/09/13/et-si-mysql-etait-mort/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL : On Duplicate Key UPDATE</title>
		<link>http://loogaroo.net/2007/08/31/mysql-on-duplicate-key-entry-update/</link>
		<comments>http://loogaroo.net/2007/08/31/mysql-on-duplicate-key-entry-update/#comments</comments>
		<pubDate>Fri, 31 Aug 2007 20:42:08 +0000</pubDate>
		<dc:creator>Manu</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[optimisation]]></category>
		<category><![CDATA[trucs et astuces]]></category>

		<guid isPermaLink="false">http://loogaroo.net/2007/09/01/mysql-on-duplicate-key-entry-update/</guid>
		<description><![CDATA[Une problématique régulière sur un site consiste à mettre a jour des données.  Parfois la donnée existe déjà et parfois elle n&#8217;existe pas.
Vous pouvez utiliser REPLACE mais le REPLACE est simplement un DELETE suivi d&#8217;un INSERT.
Exemple :
Je recois régulièrement les données d&#8217;une station météo. Parfois je recois la température, d&#8217;autre fois je recois l&#8217;humidité&#8230;si [...]]]></description>
			<content:encoded><![CDATA[<p>Une problématique régulière sur un site consiste à mettre a jour des données.  Parfois la donnée existe déjà et parfois elle n&#8217;existe pas.</p>
<p>Vous pouvez utiliser REPLACE mais le REPLACE est simplement un DELETE suivi d&#8217;un INSERT.</p>
<p><u>Exemple :</u></p>
<p>Je recois régulièrement les données d&#8217;une station météo. Parfois je recois la température, d&#8217;autre fois je recois l&#8217;humidité&#8230;si j&#8217;utilise REPLACE quand je mets à jour la température, je vais perdre l&#8217;humidité de la station X (X etant ma clé primaire, ma table comporte une ligne par station)</p>
<p><u>Deux méthodes sont possible :</u></p>
<ol>
<li>Je fais un SELECT pour savoir si la station a déjà des données et ensuite je fais soit un INSERT soir un UPDATE.</li>
<li>J&#8217;utilise ON DUPLICATE KEY : INSERT INTO donnee_station SET temperature=15, station=&#8217;Nancy&#8217; ON DUPLICATE KEY UPDATE temperature=15;</li>
</ol>
<p>L&#8217;avantage de la deuxième méthode : cela réduit le code et je ne fais qu&#8217;une requete (meme si au niveau du serveur il en execute 2 :il essaye de faire INSERT si il recoit l&#8217;erreur Duplicate key Entry il fait UPDATE)</p>
<p>En résumé c&#8217;est plus facile est plus propre.</p>
<p>References:</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html">INSERT… ON DUPLICATE KEY UPDATE</a></li>
<li> <a href="http://dev.mysql.com/doc/refman/5.0/en/replace.html">REPLACE INTO</a></li>
</ul>

<div class="sociable">
<span class="sociable_tagline">
<strong>Partager et découvrir :</strong>
	<span>Ces icônes sont des liens vers des sites de partage de signet sociaux où les lecteurs peuvent partager et découvrir de nouveaux liens.</span>
</span>
<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;title=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE" title="bodytext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/digg.png" title="bodytext" alt="bodytext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;title=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE" title="del.icio.us"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;title=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE&amp;popup=no" title="Netvouz"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;title=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE" title="description"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.thisnext.com/pick/new/submit/sociable/?url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;name=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE" title="ThisNext"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/thisnext.png" title="ThisNext" alt="ThisNext" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;bm_description=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE&amp;plugin=soc" title="MisterWong"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/misterwong.gif" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://wists.com/s.php?c=&amp;r=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;title=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE" title="Wists"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wists.png" title="Wists" alt="Wists" class="sociable-hovers sociable_wists" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.scoopeo.com/scoop/new?newurl=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F&amp;title=MySQL%20%3A%20On%20Duplicate%20Key%20UPDATE" title="Scoopeo"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/scoopeo.png" title="Scoopeo" alt="Scoopeo" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F" title="Technorati"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.wikio.com/vote?url=http%3A%2F%2Floogaroo.net%2F2007%2F08%2F31%2Fmysql-on-duplicate-key-entry-update%2F" title="Wikio"><img src="http://loogaroo.net/wp-content/plugins/sociable/images/wikio.gif" title="Wikio" alt="Wikio" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://loogaroo.net/2007/08/31/mysql-on-duplicate-key-entry-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
