<?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>Ayuda con tus Tareas &#187; Programación</title>
	<atom:link href="http://ayuda.fotopex.com/category/programacion/feed/" rel="self" type="application/rss+xml" />
	<link>http://ayuda.fotopex.com</link>
	<description>En forma fácil</description>
	<lastBuildDate>Thu, 02 Sep 2010 13:57:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Resaltar Palabras de una Búsqueda con PHP</title>
		<link>http://ayuda.fotopex.com/programacion/php/resaltar-palabras-de-una-busqueda-con-php/</link>
		<comments>http://ayuda.fotopex.com/programacion/php/resaltar-palabras-de-una-busqueda-con-php/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 23:34:00 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[búsqueda]]></category>
		<category><![CDATA[palabra]]></category>
		<category><![CDATA[Resaltar]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=786</guid>
		<description><![CDATA[Si necesitas resaltar determinadas palabras dentro de un texto. Por ejemplo al mostrar los resultados de una búsqueda, podemos resaltar los términos buscados con la siguiente función: Texto Plano PHP: function highlight&#40;$cadena, $arr_palabras&#41; &#123; &#160; &#160; if &#40;!is_array &#40;$arr_palabras&#41; &#124;&#124; empty &#40;$arr_palabras&#41; &#124;&#124; !is_string &#40;$cadena&#41;&#41; &#123; &#160; &#160; &#160; &#160; return false; &#160; &#160; &#125; [...]]]></description>
			<content:encoded><![CDATA[<div style="padding: 5px; float: left; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p>Si necesitas resaltar determinadas palabras dentro de un texto. Por ejemplo al mostrar los resultados de una búsqueda, podemos resaltar los términos buscados con la siguiente función:</p>
<div style="clear:both;"></div>
<div class="igBar"><span id="lphp-3"><a href="#" onclick="javascript:showPlainTxt('php-3'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-3">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> highlight<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cadena</span>, <span style="color:#0000FF;">$arr_palabras</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/is_array" target="_blank"><span style="color:#000066;">is_array</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$arr_palabras</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <a href="http://www.php.net/empty" target="_blank"><span style="color:#000066;">empty</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$arr_palabras</span><span style="color:#006600; font-weight:bold;">&#41;</span> || !<a href="http://www.php.net/is_string" target="_blank"><span style="color:#000066;">is_string</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cadena</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$str_palabras</span> = <a href="http://www.php.net/implode" target="_blank"><span style="color:#000066;">implode</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'|'</span>, <span style="color:#0000FF;">$arr_palabras</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;&nbsp; &nbsp;<span style="color:#616100;">return</span> <a href="http://www.php.net/preg_replace" target="_blank"><span style="color:#000066;">preg_replace</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'@<span style="color:#000099; font-weight:bold;">\b</span>('</span>.<span style="color:#0000FF;">$str_palabras</span>.<span style="color:#FF0000;">')<span style="color:#000099; font-weight:bold;">\b</span>@si'</span>, <span style="color:#FF0000;">'&lt;strong style=&quot;background-color:yellow&quot;&gt;$1&lt;/strong&gt;'</span>, <span style="color:#0000FF;">$cadena</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>y se utiliza de la siguiente manera:</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$Texto</span> = <span style="color:#FF0000;">"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut adipiscing risus nec arcu interdum at lobortis neque auctor. Morbi in gravida ipsum. Nunc imperdiet, metus sit amet fermentum volutpat, nisi tortor auctor dui, sed porttitor augue mi vitae arcu. Mauris vitae ante sit amet elit tincidunt eleifend et tempor est. Aenean vitae viverra velit. Maecenas pulvinar dolor at ante eleifend vitae fermentum dui auctor. Pellentesque fringilla ultrices odio, vitae elementum lorem gravida in. Curabitur tincidunt sagittis luctus. Cras sit amet sagittis sapien. Nunc tempus dapibus nibh, et posuere nibh aliquam in. "</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$Palabras</span> = <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Lorem"</span>,<span style="color:#FF0000;">"sit"</span>,<span style="color:#FF0000;">"amet"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> highlight<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$Texto</span>, <span style="color:#0000FF;">$Palabras</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/php/resaltar-palabras-de-una-busqueda-con-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acortar URL con PHP</title>
		<link>http://ayuda.fotopex.com/programacion/php/acortar-url-con-php/</link>
		<comments>http://ayuda.fotopex.com/programacion/php/acortar-url-con-php/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 23:14:14 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[acortar]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=781</guid>
		<description><![CDATA[Vamos a ver como podemos acortar una dirección url con el servicio tinyurl y php, y es que en ocasiones nos excedemos con las direcciones url y es complicado manejarlas en mensajes de correo electrónico o publicarlas en algún servicio. Texto Plano PHP: &#60;?php function myUrl&#40;$url&#41;&#123; &#160; &#160; $apiurl = "http://tinyurl.com/api-create.php?url=".$url; &#160; &#160; $url_corta = [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ayuda.fotopex.com/wp-content/uploads/2010/08/tiny-230x230.png" alt="" title="tiny" width="230" height="230" class="alignleft size-thumbnail wp-image-784" /><br />
Vamos a ver como podemos acortar una dirección <strong>url </strong>con el  servicio <strong>tinyurl</strong> y php, y es que en ocasiones nos excedemos con las direcciones url y es complicado manejarlas en mensajes de correo electrónico o publicarlas en algún servicio.</p>
<div style="padding: 5px; float: right; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div style="clear:both;"></div>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showPlainTxt('php-6'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> myUrl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$apiurl</span> = <span style="color:#FF0000;">"http://tinyurl.com/api-create.php?url="</span>.<span style="color:#0000FF;">$url</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$url_corta</span> = <a href="http://www.php.net/file_get_contents" target="_blank"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$apiurl</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$url_corta</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Ejemplo de uso</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> myUrl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'http://ayuda.fotopex.com/programacion/php/grafica-vertical/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Así quedaría de una forma más ligera.<br />
<a href="http://tinyurl.com/2fp8s57">http://tinyurl.com/2fp8s57</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/php/acortar-url-con-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manejo de Miniaturas (Thumbnails) de WordPress</title>
		<link>http://ayuda.fotopex.com/programacion/html/manejo-de-miniaturas-thumbnails-de-wordpress/</link>
		<comments>http://ayuda.fotopex.com/programacion/html/manejo-de-miniaturas-thumbnails-de-wordpress/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 12:46:43 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Miniaturas]]></category>
		<category><![CDATA[Thumbnails]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=780</guid>
		<description><![CDATA[Añadir una miniatura a un post. Podemos añadir las thumbnails a los posts a través de una opción en la barra lateral del panel de creación de posts o desde el menú de subidas de imágenes haciendo clic en “Set Thumbnail”. Pero antes, no olvides que tu plantilla debe contener la instrucción add_theme_support( 'post-thumbnails' ); [...]]]></description>
			<content:encoded><![CDATA[<div style="padding: 5px; float: left; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p><strong>Añadir una miniatura a un post.</strong></p>
<p>Podemos añadir las thumbnails a los posts a través de una opción en la barra lateral del panel de creación de posts o desde el menú de subidas de imágenes haciendo clic en “Set Thumbnail”.<br />
Pero antes, no olvides que tu plantilla debe contener la instrucción <strong>add_theme_support( 'post-thumbnails' );</strong> en el archivo <strong>functions.php</strong></p>
<div style="clear:both;"></div>
<p>Ahora si vamos a:<br />
<strong>Mostrar la miniatura en tu plantilla.</strong></p>
<p>Para mostrar la miniatura en tu plantilla, deberás editarla manualmente y llamar a la siguiente función donde quiera que se muestre la imagen:</p>
<div class="igBar"><span id="lphp-15"><a href="#" onclick="javascript:showPlainTxt('php-15'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-15">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div style="clear:both;"></div>
<p><span id="more-780"></span><br />
Seguramente haya mucha gente que prefiera adaptarla lo máximo posible a su theme. Esto se puede hacer añadiendo una serie de parámetros a la función, como el tamaño, la clase ( class de CSS), el atributo alt o el title.</p>
<p><strong>Gestionando el tamaño de la miniatura.</strong></p>
<p>Por defecto, el tamaño de la miniatura será el que tengamos seleccionado para las miniaturas de WordPress (‘thumbnail’) aunque se pueden elegir los otros dos tamaños o incluso personalizarlos según nuestros gustos o necesidades:<br />
Tamaño pequeño:</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showPlainTxt('php-16'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'thumbnail'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Tamaño medio:</p>
<div class="igBar"><span id="lphp-17"><a href="#" onclick="javascript:showPlainTxt('php-17'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-17">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'medium'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Tamaño grande:</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showPlainTxt('php-18'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'large'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Tamaño personalizado (ancho, alto):</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showPlainTxt('php-19'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#CC66CC;color:#800000;">200</span>,<span style="color:#CC66CC;color:#800000;">200</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si definimos el tamaño de la miniatura de esta manera, cogerá el tamaño normal de la imagen y lo reducirá, no cogerá el tamaño ‘thumbnail’.</p>
<p><strong>Gestionando la clase de la miniatura</strong></p>
<p>La clase de la miniatura servirá para añadirle un estilo predefinido en la hoja de estilos del theme. Por defecto es .wp-post-image, pero podremos elegir la que queramos definiendo nuestro propio estilo:</p>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showPlainTxt('php-20'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'medium'</span>, <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'class'</span> =&gt; <span style="color:#FF0000;">'imagen_post'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Gestionando los atributos alt y title.</strong></p>
<p>De la misma manera que hemos visto anteriormente, también se pueden modificar a nuestro gusto los atributos ‘alt’ y ‘title’ de la miniatura, pudiendo ponerlo lo que queramos:</p>
<div class="igBar"><span id="lphp-21"><a href="#" onclick="javascript:showPlainTxt('php-21'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-21">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'medium'</span>, <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'class'</span> =&gt; <span style="color:#FF0000;">'alignleft'</span>, <span style="color:#FF0000;">'alt'</span> =&gt; <span style="color:#FF0000;">'alt_que_queramos'</span>, <span style="color:#FF0000;">'title'</span> =&gt; <span style="color:#FF0000;">'titulo_que_queramos'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Incluyendo el código completo y a prueba de fallos.</strong></p>
<p>Deberemos tener en cuenta que los artículos antiguos no tendrán asginada una miniatura, por lo que los deberemos tratar de una manera diferente al resto mediante una comprobación ‘has_post_thumbnail’. En caso afirmativo se mostrará la miniatura, pero en caso negativo se mostrará la miniatura que hayamos utilizado hasta entonces o sino una imagen genérica.</p>
<div class="igBar"><span id="lphp-22"><a href="#" onclick="javascript:showPlainTxt('php-22'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-22">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/function_exists" target="_blank"><span style="color:#000066;">function_exists</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'has_post_thumbnail'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; <span style="color:#006600; font-weight:bold;">&#40;</span>has_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; the_post_thumbnail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$postimage</span> = get_post_meta<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$post</span>-&gt;<span style="color:#006600;">ID</span>, <span style="color:#FF0000;">'post-image'</span>, <span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$postimage</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;img src=&quot;'</span>.<span style="color:#0000FF;">$postimage</span>.<span style="color:#FF0000;">'&quot; alt=&quot;&quot; /&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;img src=&quot;http://tupagina.com/thumbail_generica.png&quot; alt=&quot;Thumbnail genérica&quot; /&gt;'</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/html/manejo-de-miniaturas-thumbnails-de-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generador Simple de Claves Aleatorias</title>
		<link>http://ayuda.fotopex.com/programacion/php/generador-simple-de-claves-aleatorias/</link>
		<comments>http://ayuda.fotopex.com/programacion/php/generador-simple-de-claves-aleatorias/#comments</comments>
		<pubDate>Mon, 10 May 2010 19:32:11 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Aleatorio]]></category>
		<category><![CDATA[Clave]]></category>
		<category><![CDATA[Contraseña]]></category>
		<category><![CDATA[Funciones]]></category>
		<category><![CDATA[Password]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=770</guid>
		<description><![CDATA[Vamos a realizar 4 ejemplos para generar un password aleatorio y así obtener contraseñas de una forma fácil. El primer generador sencillo y simple de claves aleatorias. Utilizaremos las instrucciones md5() y rand(), sin duda el ejemplo más sencillo, fácil y rápido de implementar. Texto Plano PHP: &#60;?php function password_rand_md5&#40;&#41;&#123; &#160; &#160; $longitud = 8; [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ayuda.fotopex.com/wp-content/uploads/2010/05/password-fotopex.png" alt="" title="password-fotopex" width="181" height="171" class="alignleft size-full wp-image-771" />Vamos a realizar <strong>4 ejemplos</strong> para generar un password aleatorio y así obtener contraseñas de una forma fácil.<br />
<strong>El primer generador</strong> sencillo y simple de claves aleatorias. Utilizaremos las instrucciones <strong>md5()</strong> y<strong> rand()</strong>, sin duda el ejemplo más <strong>sencillo</strong>,<strong> fácil </strong>y <strong>rápido </strong>de implementar.</p>
<div style="clear:both;"></div>
<div class="igBar"><span id="lphp-27"><a href="#" onclick="javascript:showPlainTxt('php-27'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-27">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> password_rand_md5<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$longitud</span> = <span style="color:#CC66CC;color:#800000;">8</span>; <span style="color:#FF9933; font-style:italic;">// longitud de caracteres que queremos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$password</span> = <a href="http://www.php.net/substr" target="_blank"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/md5" target="_blank"><span style="color:#000066;">md5</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/rand" target="_blank"><span style="color:#000066;">rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#0000FF;">$longitud</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$password</span> ; <span style="color:#FF9933; font-style:italic;">// mostramos la contraseña</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">password_rand_md5<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>&nbsp;</p>
<p><span id="more-770"></span></p>
<div style="padding: 5px; float: right; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p><strong> En el segundo ejemplo</strong> vamos a generar un pasword con una palabra y 2 dígitos, podemos complicarlo si agregamos símbolos como #&#038;)($ etc. Considero que este ejemplo es el más sencillo y con <strong>contraseñas </strong>fáciles de recordar.</p>
<div style="clear:both;"></div>
<div class="igBar"><span id="lphp-28"><a href="#" onclick="javascript:showPlainTxt('php-28'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-28">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> password_palabra<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/srand" target="_blank"><span style="color:#000066;">srand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>float<span style="color:#006600; font-weight:bold;">&#41;</span> <a href="http://www.php.net/microtime" target="_blank"><span style="color:#000066;">microtime</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#CC66CC;color:#800000;">10000000</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numeros</span> =&nbsp; <a href="http://www.php.net/range" target="_blank"><span style="color:#000066;">range</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>,<span style="color:#CC66CC;color:#800000;">9</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$texto</span> = <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Enero'</span>, <span style="color:#FF0000;">'Febrero'</span>, <span style="color:#FF0000;">'Marzo'</span>, <span style="color:#FF0000;">'Abril'</span>, <span style="color:#FF0000;">'Mayo'</span>, <span style="color:#FF0000;">'Junio'</span>, <span style="color:#FF0000;">'Julio'</span>,<span style="color:#FF0000;">'Agosto'</span>, <span style="color:#FF0000;">'Septiembre'</span>, <span style="color:#FF0000;">'Octubre'</span>, <span style="color:#FF0000;">'Noviembre'</span>, <span style="color:#FF0000;">'Diciembre'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$texto_aleatorio</span> = <a href="http://www.php.net/array_rand" target="_blank"><span style="color:#000066;">array_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$texto</span>, <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numeros_aleatorios</span> = <a href="http://www.php.net/array_rand" target="_blank"><span style="color:#000066;">array_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeros</span>, <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// generamos la clave con una palabra y dos numeros al final</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$password</span>= <span style="color:#0000FF;">$texto</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$texto_aleatorio</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#0000FF;">$numeros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$numeros_aleatorios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#0000FF;">$numeros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$numeros_aleatorios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// devolvemos la contraseña</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$password</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$password</span> = password_palabra<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// devuelve algocom Septiembre37</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$password</span>.<span style="color:#FF0000;">'&lt;br /&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>En el tercer ejemplo</strong> vamos a componer el <strong>password </strong>con letras aleatorias y de igual forma agregaremos 2 dígitos.</p>
<div class="igBar"><span id="lphp-29"><a href="#" onclick="javascript:showPlainTxt('php-29'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-29">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> password_rand<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$longitud</span> = <span style="color:#CC66CC;color:#800000;">7</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$letras</span> = <a href="http://www.php.net/range" target="_blank"><span style="color:#000066;">range</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'a'</span>,<span style="color:#FF0000;">'z'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numeros</span> =&nbsp; <a href="http://www.php.net/range" target="_blank"><span style="color:#000066;">range</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>,<span style="color:#CC66CC;color:#800000;">9</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numeros_aleatorios</span> = <a href="http://www.php.net/array_rand" target="_blank"><span style="color:#000066;">array_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeros</span>, <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/srand" target="_blank"><span style="color:#000066;">srand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>float<span style="color:#006600; font-weight:bold;">&#41;</span> <a href="http://www.php.net/microtime" target="_blank"><span style="color:#000066;">microtime</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#CC66CC;color:#800000;">10000000</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$password</span> = <span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$rand_keys</span> = <a href="http://www.php.net/array_rand" target="_blank"><span style="color:#000066;">array_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$letras</span>, <span style="color:#0000FF;">$longitud</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">foreach</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rand_keys</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#41;</span>&nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$password</span> .= <span style="color:#0000FF;">$letras</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// agregamos dos numeros al final</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$password</span> = <a href="http://www.php.net/substr" target="_blank"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$password</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#0000FF;">$longitud</span>-<span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$password</span>.<span style="color:#0000FF;">$numeros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$numeros_aleatorios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#0000FF;">$numeros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$numeros_aleatorios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// pedimos una clave con 10 characteres</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$password</span> = password_rand<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// devuelve algo como cejklosv12</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$password</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Para el cuarto ejemplo</strong> vamos a generar la contraseña alternando vocales y consonantes.</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showPlainTxt('php-30'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> password_rand_alt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$longitud</span>=<span style="color:#CC66CC;color:#800000;">8</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$voc</span> = <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span>a,e,i,o,u<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$con</span> = <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span>b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,w,x,y,z<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numeros</span> =&nbsp; <a href="http://www.php.net/range" target="_blank"><span style="color:#000066;">range</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span>,<span style="color:#CC66CC;color:#800000;">9</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numeros_aleatorios</span> = <a href="http://www.php.net/array_rand" target="_blank"><span style="color:#000066;">array_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeros</span>, <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$password</span> = <span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$inicio</span>&nbsp; = <a href="http://www.php.net/mt_rand" target="_blank"><span style="color:#000066;">mt_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$n</span>=<span style="color:#CC66CC;color:#800000;">0</span>; <span style="color:#0000FF;">$n</span>&lt;<span style="color:#0000FF;">$longitud</span>; <span style="color:#0000FF;">$n</span>++<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$inicio</span>==<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$inicio</span>=<span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$password</span> .= <span style="color:#0000FF;">$con</span><span style="color:#006600; font-weight:bold;">&#91;</span><a href="http://www.php.net/mt_rand" target="_blank"><span style="color:#000066;">mt_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span>,<a href="http://www.php.net/count" target="_blank"><span style="color:#000066;">count</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$con</span><span style="color:#006600; font-weight:bold;">&#41;</span>-<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$password</span> .= <span style="color:#0000FF;">$voc</span><span style="color:#006600; font-weight:bold;">&#91;</span><a href="http://www.php.net/mt_rand" target="_blank"><span style="color:#000066;">mt_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span>,<a href="http://www.php.net/count" target="_blank"><span style="color:#000066;">count</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$voc</span><span style="color:#006600; font-weight:bold;">&#41;</span>-<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$password</span> .= <span style="color:#0000FF;">$con</span><span style="color:#006600; font-weight:bold;">&#91;</span><a href="http://www.php.net/mt_rand" target="_blank"><span style="color:#000066;">mt_rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span>,<a href="http://www.php.net/count" target="_blank"><span style="color:#000066;">count</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$con</span><span style="color:#006600; font-weight:bold;">&#41;</span>-<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$password</span> = <a href="http://www.php.net/substr" target="_blank"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$password</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#0000FF;">$longitud</span>-<span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$password</span>.<span style="color:#0000FF;">$numeros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$numeros_aleatorios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#0000FF;">$numeros</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$numeros_aleatorios</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// pedimos una clave con 10 characteres</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$password</span> = password_rand_alt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//devuelve algo como etopoyar36</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$password</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si deseas puedes bajar el archivo de ejemplo en <a href='http://ayuda.fotopex.com/wp-content/uploads/2010/05/generador-claves.zip'>este enlace con el nombre de generador-claves.zip</a>.</p>
<p>Puedes ejecutar un ejemplo en <a href="http://ayuda.fotopex.com/ejemplos/generador-claves.php">este enlace</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/php/generador-simple-de-claves-aleatorias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Botón con Enlace URL</title>
		<link>http://ayuda.fotopex.com/programacion/html/boton-con-enlace-url/</link>
		<comments>http://ayuda.fotopex.com/programacion/html/boton-con-enlace-url/#comments</comments>
		<pubDate>Sat, 01 May 2010 20:51:40 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Botón]]></category>
		<category><![CDATA[Enlace]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=768</guid>
		<description><![CDATA[Algunos ejemplos de como un button haga las funciones de enlace a otra pagina. Texto Plano HTML: &#60;input type="button" onclick="location.href='http://fotopex.com'" value="FotoPex.com" onmouseover="window.status='dentro'" onmouseout="window.status=''" /&#62; También se puede dar estilo al enlace para que se vea como un botón: FotoPex.com Texto Plano HTML: &#60;a href="http://fotopex.com/" style="background-color: #eeeeee; border: 1px black outset"&#62; FotoPex.com&#60;/a&#62;]]></description>
			<content:encoded><![CDATA[<p>
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
<p>Algunos ejemplos de como un button haga las funciones de enlace a otra pagina.<br />
<input type="button" onclick="location.href='http://fotopex.com/'" value="FotoPex.com" onmouseover="window.status='dentro'" onmouseout="window.status=''" />
<div class="igBar"><span id="lhtml-33"><a href="#" onclick="javascript:showPlainTxt('html-33'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-33">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"button"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"location.href='http://fotopex.com'"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"FotoPex.com"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">onmouseover</span>=<span style="color: #ff0000;">"window.status='dentro'"</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">onmouseout</span>=<span style="color: #ff0000;">"window.status=''"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>También se puede dar estilo al enlace para que se vea como un botón: <a href="http://fotopex.com/" style="background-color: #eeeeee; border: 1px black outset"> FotoPex.com</a></p>
<div class="igBar"><span id="lhtml-34"><a href="#" onclick="javascript:showPlainTxt('html-34'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-34">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://fotopex.com/"</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">"background-color: #eeeeee; border: 1px black outset"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span> FotoPex.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/html/boton-con-enlace-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Devolver un Array en una Funcion con Return</title>
		<link>http://ayuda.fotopex.com/programacion/php/devolver-un-array-en-una-funcion-con-return/</link>
		<comments>http://ayuda.fotopex.com/programacion/php/devolver-un-array-en-una-funcion-con-return/#comments</comments>
		<pubDate>Sat, 01 May 2010 20:42:19 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Función]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=766</guid>
		<description><![CDATA[La idea es simple: vamos a devolver un array con return dentro de una función, después creas un segundo array al cual se le pasaran los datos que devuelve la función. Aquí esta un ejemplo muy sencillo: Texto Plano PHP: &#60;?php //creamos nuestra función. function saludo&#40;&#41;&#123; &#160; $matriz = array&#40;"Gracias", "por visitar", "FotoPex.com"&#41;; &#160; return [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ayuda.fotopex.com/wp-content/uploads/2010/05/devolver-array-return.png" alt="" title="devolver-array-return" width="500" height="221" class="aligncenter size-full wp-image-767" /><br />
La idea es simple: vamos a devolver un array con return dentro de una función, después creas un segundo <strong>array </strong>al cual se le pasaran los datos que devuelve la función.</p>
<p>Aquí esta un ejemplo muy sencillo:<br />
<span id="more-766"></span></p>
<div class="igBar"><span id="lphp-36"><a href="#" onclick="javascript:showPlainTxt('php-36'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-36">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//creamos nuestra función.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> saludo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$matriz</span> = <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Gracias"</span>, <span style="color:#FF0000;">"por visitar"</span>, <span style="color:#FF0000;">"FotoPex.com"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$matriz</span>; <span style="color:#FF9933; font-style:italic;">// regresamos el arreglo.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span>&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$mostrar</span>=<a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// declaramos la nueva variable.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$mostrar</span>=saludo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// aquí atrapamos los valores del array devuelto por la función</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#FF9933; font-style:italic;">// mostramos el resultado</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$mostrar</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#FF0000;">' '</span>.<span style="color:#0000FF;">$mostrar</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#FF0000;">' '</span>.<span style="color:#0000FF;">$mostrar</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/php/devolver-un-array-en-una-funcion-con-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gráfica Vertical</title>
		<link>http://ayuda.fotopex.com/programacion/php/grafica-vertical/</link>
		<comments>http://ayuda.fotopex.com/programacion/php/grafica-vertical/#comments</comments>
		<pubDate>Sat, 01 May 2010 20:11:50 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[colores]]></category>
		<category><![CDATA[Gráfica]]></category>
		<category><![CDATA[Vertical]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=762</guid>
		<description><![CDATA[Aprovechando que hemos lanzado el concurso para seleccionar a la Señorita Prepa Colosio 2010 y Chico Prepa Colosio 2010, vamos a mostrarte como hacer una Gráfica Vertical. En el siguiente ejemplo vamos a usar dos tablas: encuestas y respuestas, la idea como siempre es que entiendas lo básico y después podrías mejorarlo. Texto Plano PHP: [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ayuda.fotopex.com/wp-content/uploads/2010/05/grafica-vertical.png" alt="" title="grafica-vertical" width="601" height="158" class="aligncenter size-full wp-image-763" /><br />
Aprovechando que hemos lanzado el concurso para seleccionar a la <a href="http://votapex.com/?idPoll=2" target="_blank">Señorita Prepa Colosio 2010</a> y <a href="http://votapex.com/?idPoll=1" target="_blank">Chico Prepa Colosio 2010</a>, vamos a mostrarte como hacer una Gráfica Vertical.</p>
<div style="padding: 5px; float: right; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p>En el siguiente ejemplo vamos a usar dos tablas: encuestas y respuestas, la idea como siempre es que entiendas lo básico y después podrías mejorarlo.</p>
<div style="clear:both;"></div>
<p><span id="more-762"></span></p>
<div class="igBar"><span id="lphp-39"><a href="#" onclick="javascript:showPlainTxt('php-39'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-39">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/****************************************</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* Grafica vertical en base a dos tablas *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*&nbsp; &nbsp; &nbsp; www.ayuda.FotoPex.com&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*****************************************/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> grafica_encuesta_vertical<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idEncuesta</span>=<span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// seleccionamos los colores que utilizaremos en cada barra</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$colores</span> = <a href="http://www.php.net/array" target="_blank"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'3366CC'</span>,<span style="color:#FF0000;">'DC3912'</span>,<span style="color:#FF0000;">'109618'</span>,<span style="color:#FF0000;">'FF9900'</span>,<span style="color:#FF0000;">'375181'</span>,<span style="color:#FF0000;">'FFCC33'</span>,<span style="color:#FF0000;">'082454'</span>,<span style="color:#FF0000;">'a3129e'</span>,<span style="color:#FF0000;">'e57e0f'</span>,<span style="color:#FF0000;">'256605'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$rs</span>=<a href="http://www.php.net/mysql_query" target="_blank"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'SELECT encuestas.pregunta FROM `respuestas` </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; INNER JOIN encuestas ON encuestas.id = respuestas.id_poll </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; WHERE respuestas.id_poll = <span style="color:#000099; font-weight:bold;">\'</span>'</span>.<span style="color:#0000FF;">$idEncuesta</span>.<span style="color:#FF0000;">'<span style="color:#000099; font-weight:bold;">\'</span> ;'</span><span style="color:#006600; font-weight:bold;">&#41;</span>or <a href="http://www.php.net/die" target="_blank"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/mysql_error" target="_blank"><span style="color:#000066;">mysql_error</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$total_votos</span> = <a href="http://www.php.net/mysql_num_rows" target="_blank"><span style="color:#000066;">mysql_num_rows</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rs</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// obtenemos el total de los votos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$rowPreg</span> = <a href="http://www.php.net/mysql_fetch_object" target="_blank"><span style="color:#000066;">mysql_fetch_object</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rs</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$NombreEncuesta</span> = <span style="color:#0000FF;">$rowPreg</span>-&gt;<span style="color:#006600;">pregunta</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/mysql_free_result" target="_blank"><span style="color:#000066;">mysql_free_result</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rs</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp;&nbsp;&nbsp;&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//buscamos las respuestas</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$ssql</span>=<span style="color:#FF0000;">'SELECT `id_nombre` as participante , count( *&nbsp; ) AS votos </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; FROM `respuestas` </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; WHERE respuestas.id_poll = <span style="color:#000099; font-weight:bold;">\'</span>'</span>.<span style="color:#0000FF;">$idEncuesta</span>.<span style="color:#FF0000;">'<span style="color:#000099; font-weight:bold;">\'</span> </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; GROUP BY `id_opcion` LIMIT 10; '</span>; <span style="color:#FF9933; font-style:italic;">// limte de 10 opciones para votar</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query" target="_blank"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ssql</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$numOpciones</span> = <a href="http://www.php.net/mysql_num_rows" target="_blank"><span style="color:#000066;">mysql_num_rows</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// obtenenemos el numero real de opciones votadas</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$anchoBarra</span> = <span style="color:#CC66CC;color:#800000;">10</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numOpciones</span>&gt; <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$anchoBarra</span> = @<a href="http://www.php.net/round" target="_blank"><span style="color:#000066;">round</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">100</span>/<span style="color:#0000FF;">$numOpciones</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// se expresara en %</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$ontRowOpt</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$row</span>=<a href="http://www.php.net/mysql_fetch_object" target="_blank"><span style="color:#000066;">mysql_fetch_object</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$result</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$porcentaje</span> = <a href="http://www.php.net/round" target="_blank"><span style="color:#000066;">round</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$row</span>-&gt;<span style="color:#006600;">votos</span>/<span style="color:#0000FF;">$total_votos</span><span style="color:#006600; font-weight:bold;">&#41;</span>*<span style="color:#CC66CC;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$votos_x_opcion</span>=<span style="color:#0000FF;">$row</span>-&gt;<span style="color:#006600;">votos</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$barras</span>.= <span style="color:#FF0000;">'&lt;td height=&quot;100px;&quot; width=&quot;'</span>.<span style="color:#0000FF;">$anchoBarra</span>.<span style="color:#FF0000;">'%&quot; valign=&quot;bottom&quot;&gt;'</span>.<span style="color:#0000FF;">$row</span>-&gt;<span style="color:#006600;">votos</span>.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'&lt;br /&gt;&lt;div style=&quot;background:#'</span>.<span style="color:#0000FF;">$colores</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$ontRowOpt</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#FF0000;">'; height:'</span>.<span style="color:#0000FF;">$porcentaje</span>.<span style="color:#FF0000;">'px;&quot;&gt;&lt;/div&gt;&lt;/td&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$footers</span>.= <span style="color:#FF0000;">'&lt;td height=&quot;15px;&quot;&gt;'</span>.<span style="color:#0000FF;">$row</span>-&gt;<span style="color:#006600;">participante</span>.<span style="color:#FF0000;">'&lt;/td&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$ontRowOpt</span>++;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;div class=&quot;box1&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;table height=&quot;170px;&quot; width=&quot;600px;&quot;&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;tr&nbsp; align=&quot;center&quot;&gt;&lt;td colspan=&quot;'</span>.<span style="color:#0000FF;">$numOpciones</span>.<span style="color:#FF0000;">'&quot;&gt;&lt;b style=&quot;color:#055A91&quot;&gt;'</span>.<a href="http://www.php.net/html_entity_decode" target="_blank"><span style="color:#000066;">html_entity_decode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$NombreEncuesta</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#FF0000;">' '</span>.<span style="color:#0000FF;">$total_votos</span>.<span style="color:#FF0000;">' Votos en Total&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;tr&nbsp; align=&quot;center&quot;&gt;'</span>.<span style="color:#0000FF;">$barras</span>.<span style="color:#FF0000;">'&lt;/tr&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;tr&nbsp; align=&quot;center&quot;&gt;'</span>.<span style="color:#0000FF;">$footers</span>.<span style="color:#FF0000;">'&lt;/tr&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;/table&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;/div&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;div class=&quot;divClear&quot;&gt;&lt;/div&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>ahora solo necesitamos llamarla </p>
<div class="igBar"><span id="lphp-40"><a href="#" onclick="javascript:showPlainTxt('php-40'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-40">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> grafica_encuesta_vertical<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$idPoll</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Algunas veces hay problemas con el Copy/Paste, así que este es el archivo del ejemplo.<br />
<a href='http://ayuda.fotopex.com/wp-content/uploads/2010/05/ejemplo-grafica-vertical.zip'>Ejemplo Gráfica Vertical</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/php/grafica-vertical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convertir Acentos a minúsculas en php</title>
		<link>http://ayuda.fotopex.com/programacion/php/convertir-acentos-a-minusculas-en-php/</link>
		<comments>http://ayuda.fotopex.com/programacion/php/convertir-acentos-a-minusculas-en-php/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 16:20:07 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[mb_strtolower]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[strtolower]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=758</guid>
		<description><![CDATA[mb_strtolower devuelve un string con todas sus letras en minúsculas. Ejemplo: Texto Plano PHP: echo strtolower&#40;'LEÓN'&#41; Se queda ígual: leÓn Y utilizando la función mb_strtolower con la codificación utf8: Texto Plano PHP: $str = mb_strtolower&#40; $str,"UTF-8"&#41;;]]></description>
			<content:encoded><![CDATA[<div style="padding: 5px; float: right; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p><strong>mb_strtolower</strong> devuelve un string con todas sus letras en <strong>minúsculas</strong>.<br />
Ejemplo:</p>
<div style="clear:both;"></div>
<div class="igBar"><span id="lphp-43"><a href="#" onclick="javascript:showPlainTxt('php-43'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-43">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo" target="_blank"><span style="color:#000066;">echo</span></a> <a href="http://www.php.net/strtolower" target="_blank"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'LEÓN'</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Se queda ígual: leÓn</p>
<p>Y utilizando la función <strong>mb_strtolower</strong> con la codificación utf8:</p>
<div class="igBar"><span id="lphp-44"><a href="#" onclick="javascript:showPlainTxt('php-44'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-44">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$str</span> = <a href="http://www.php.net/mb_strtolower" target="_blank"><span style="color:#000066;">mb_strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$str</span>,<span style="color:#FF0000;">"UTF-8"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/php/convertir-acentos-a-minusculas-en-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solución error SQL_BIG_SELECTS</title>
		<link>http://ayuda.fotopex.com/programacion/bases-de-datos/solucion-error-sql_big_selects/</link>
		<comments>http://ayuda.fotopex.com/programacion/bases-de-datos/solucion-error-sql_big_selects/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 21:03:50 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[Bases de Datos]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SQL_BIG_SELECTS]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=749</guid>
		<description><![CDATA[El problema viene porque estas cargando una consulta que MySqL considera que puede ser grande ó se hacen bastantes relaciones entre las tablas. The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay Ese error es debido a la variable de MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>El problema viene porque estas cargando una consulta que MySqL considera que puede ser grande ó se hacen bastantes relaciones entre las tablas.</p>
<blockquote><p>The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay</p></blockquote>
<p>Ese error es debido a la variable de MySQL SQL_BIG_SELECTS, y en el mensaje mismo te indica la respuesta:</p>
<blockquote><p><strong>SELECT</strong> examinará más de <strong>MAX_JOIN_SIZE</strong> filas, revisa tu <strong>WHERE</strong> y usa <strong><em>SET SQL_BIG_SELECTS = 1</em></strong> o <strong>SET SQL_MAX_JOIN_SIZE = #</strong> si el SELECT está bien.
</p></blockquote>
<p><span id="more-749"></span></p>
<div style="padding: 5px; float: right; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p>Así que antes de correr tu consulta debes indicar al MySQL que permita el uso de consultas extendidas, para eso hay que ejecutar el siguiente query con la variable <strong>SQL_BIG_SELECTS</strong>:</p>
<blockquote><p>mysql_query("set sql_big_selects=1");</p></blockquote>
<div style="clear:both;"></div>
<p>Ejemplo:</p>
<div class="igBar"><span id="lphp-46"><a href="#" onclick="javascript:showPlainTxt('php-46'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-46">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mysql_query" target="_blank"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'SQL_BIG_SELECTS=1'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// aquí ampliamos la consulta</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$Ssql</span> = <span style="color:#FF0000;">'SELECT .... FROM ...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">INNER JOIN&nbsp; ...</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">INNER JOIN&nbsp; ...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">WHERE ....</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">AND ...</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">ORDER BY ...'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query" target="_blank"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$Ssql</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>SQL_BIG_SELECTS = {0 | 1}</strong></p>
<p>Con valor 0, MySQL aborta los comandos SELECT que probablemente tardarán mucho tiempo (esto es, comandos para los que el optimizador estima que el número de registros examinados excede el valor de max_join_size). Esto es útil cuando un comando WHERE no aconsejable se ejecuta. El valor por defecto para una nueva conexión es 1, que permite todos los comandos SELECT .</p>
<p>Si cambia la variable de sistema max_join_size a un valor distinto a DEFAULT, SQL_BIG_SELECTS se pone a 0.</p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/bases-de-datos/solucion-error-sql_big_selects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escribir datos de un OleDbDataReader a un archivo de texto</title>
		<link>http://ayuda.fotopex.com/programacion/net/escribir-datos-de-un-oledbdatareader-a-un-archivo-de-texto/</link>
		<comments>http://ayuda.fotopex.com/programacion/net/escribir-datos-de-un-oledbdatareader-a-un-archivo-de-texto/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 23:46:01 +0000</pubDate>
		<dc:creator>Mr. FotoPex</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Archivos]]></category>
		<category><![CDATA[Tabla]]></category>
		<category><![CDATA[Texto]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://ayuda.fotopex.com/?p=744</guid>
		<description><![CDATA[OleDbDataReader proporciona el modo de lectura de una secuencia de filas de datos de tipo sólo avance de un origen de datos. Esta clase no se puede heredar. Para crear OleDbDataReader, se debe llamar al método ExecuteReader del objeto OleDbCommand, en lugar de utilizar directamente un constructor. Mientras se está utilizando OleDbDataReader, el objeto OleDbConnection [...]]]></description>
			<content:encoded><![CDATA[<p><strong>OleDbDataReader</strong> proporciona el modo de lectura de una secuencia de filas de datos de tipo sólo avance de un origen de datos. Esta clase no se puede heredar. </p>
<p>Para crear OleDbDataReader, se debe llamar al método ExecuteReader del objeto OleDbCommand, en lugar de utilizar directamente un constructor.</p>
<p>Mientras se está utilizando OleDbDataReader, el objeto OleDbConnection asociado está ocupado dando servicio a OleDbDataReader, y en OleDbConnection no se puede realizar ninguna otra operación, excepto la de cerrar. Esto es así hasta que se llama al método Close de OleDbDataReader. Por ejemplo, <span id="more-744"></span>no se pueden recuperar parámetros de salida hasta después de llamar a Close.</p>
<p>Los cambios que realiza otro proceso o subproceso en un conjunto de resultados mientras se leen los datos, pueden ser visibles para el usuario de OleDbDataReader. Sin embargo, el comportamiento exacto depende de los intervalos de tiempo.</p>
<p>IsClosed y RecordsAffected son las únicas propiedades a las que se puede llamar después de cerrarse OleDbDataReader. Si bien se puede obtener acceso a la propiedad RecordsAffected mientras exista OleDbDataReader, se debe llamar siempre al método Close antes de devolver el valor de RecordsAffected para garantizar que el valor devuelto sea exacto.</p>
<div style="padding: 5px; float: right; " >
 <script type="text/javascript"><!--
google_ad_client = "pub-6087605660472467";
/* ayuda-foto-adsense-cuadro300x250, creado 4/12/08 */ 
google_ad_slot = "1220677556";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p>En el siguiente ejemplo se crean OleDbConnection, OleDbCommand y OleDbDataReader. En el ejemplo se leen los datos y se escriben en la consola. Por último, en el ejemplo se cierra OleDbDataReader y, a continuación, OleDbConnection.</p>
<div style="clear:both;"></div>
<div class="igBar"><span id="lvbnet-49"><a href="#" onclick="javascript:showPlainTxt('vbnet-49'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-49">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> ReadData<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> connectionString <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\FotoPex\FpTimer\data\data.mdb"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> queryString <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">"SELECT usuario, Format(entrada, 'hh:mm:ss') as Entrada, Format(salida, 'hh:mm:ss') as Salida FROM(bitacora) WHERE (((fecha)=#03/04/2010#)) Order by id DESC ;"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Using connection <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbConnection<span style="color: #000000;">&#40;</span>connectionString<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">command</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbCommand<span style="color: #000000;">&#40;</span>queryString, connection<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; connection.<span style="color: #0600FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> reader <span style="color: #FF8000;">As</span> OleDbDataReader = <span style="color: #0600FF;">command</span>.<span style="color: #0000FF;">ExecuteReader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">While</span> reader.<span style="color: #0000FF;">Read</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>reader<span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#800000;">0</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">While</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; reader.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> Using</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora vamos a ver una variante del ejemplo para <a href="http://ayuda.fotopex.com/programacion/net/escribir-datos-de-una-tabla-a-un-archivo-de-texto/">escribir datos de una tabla a un archivo de texto</a>, pero esta vez utilizaremos un OleDbDataReader para obtener los datos. No olvidemos declarar el NameSpace <strong>Imports System.IO</strong></p>
<div class="igBar"><span id="lvbnet-50"><a href="#" onclick="javascript:showPlainTxt('vbnet-50'); return false;">Texto Plano</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-50">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> GrabaArchivo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> cn <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbConnection<span style="color: #000000;">&#40;</span><span style="color: #808080;">"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\FotoPex\FpTimer\data\data.mdb"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> sql <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Try</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' preparamos el archivo</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> Bitacora <span style="color: #FF8000;">As</span> StreamWriter</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> NuevaLinea <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = <span style="color: #808080;">""</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> newFileName <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> = BitacoraPath &amp; <span style="color: #FF0000;">Date</span>.<span style="color: #0600FF;">Today</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"MMM dd yyyy"</span><span style="color: #000000;">&#41;</span> &amp; <span style="color: #808080;">".txt"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' verificamos si existe</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <a href="http://www.google.com/search?q=FILE+msdn.microsoft.com"><span style="color: #008000;">File</span></a>.<span style="color: #0000FF;">Exists</span><span style="color: #000000;">&#40;</span>newFileName<span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">False</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' lo creamos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Bitacora = <a href="http://www.google.com/search?q=FILE+msdn.microsoft.com"><span style="color: #008000;">File</span></a>.<span style="color: #0000FF;">CreateText</span><span style="color: #000000;">&#40;</span>newFileName<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' lo abrimos para agregar texto</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Bitacora = <a href="http://www.google.com/search?q=FILE+msdn.microsoft.com"><span style="color: #008000;">File</span></a>.<span style="color: #0000FF;">AppendText</span><span style="color: #000000;">&#40;</span>newFileName<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; NuevaLinea = <span style="color: #808080;">"Time: "</span> &amp; <span style="color: #FF0000;">Date</span>.<span style="color: #0600FF;">Now</span>.<span style="color: #0000FF;">ToShortTimeString</span> &amp; vbCrLf &amp; _</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080;">"Usuario"</span> &amp; vbTab &amp; <span style="color: #808080;">"&nbsp; Entrada&nbsp; "</span> &amp; vbTab &amp; <span style="color: #808080;">"&nbsp; Salida&nbsp; "</span> &amp; vbTab &amp; <span style="color: #808080;">"Total"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'agregamos datos al buffer en una linea nueva</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; Bitacora.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>NuevaLinea<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' buscamos los resultados</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; cn.<span style="color: #0600FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' por otro carácter</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; sql = <span style="color: #808080;">"SELECT usuario, Format(entrada, 'hh:mm:ss') as Entrada, Format(salida, 'hh:mm:ss') as Salida FROM(bitacora) WHERE (((fecha)=#03/04/2010#)) Order by id DESC ;"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'creamos un comando</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> cmd <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> OleDbCommand<span style="color: #000000;">&#40;</span>sql, cn<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> dr <span style="color: #FF8000;">As</span> OleDbDataReader = cmd.<span style="color: #0000FF;">ExecuteReader</span><span style="color: #000000;">&#40;</span>CommandBehavior.<span style="color: #0000FF;">CloseConnection</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Do</span> <span style="color: #0600FF;">While</span> dr.<span style="color: #0000FF;">Read</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; NuevaLinea = dr.<span style="color: #0000FF;">Item</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"usuario"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span> &amp; vbTab &amp; dr.<span style="color: #0000FF;">Item</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Entrada"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span> &amp; vbTab &amp; dr.<span style="color: #0000FF;">Item</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"Salida"</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span> &amp; vbTab &amp; <span style="color: #808080;">"Total"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Bitacora.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>NuevaLinea<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">' limpiamos el buffer y escribimos los datos contenidos al stream</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Bitacora.<span style="color: #0000FF;">Flush</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Loop</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; NuevaLinea = vbCrLf &amp; <span style="color: #808080;">"********************* ***** "</span> &amp; vbCrLf</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; Bitacora.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>NuevaLinea<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; Bitacora.<span style="color: #0000FF;">Flush</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; Bitacora.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">' no olvides cerrar el archivo</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; dr.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">Catch</span> ex <span style="color: #FF8000;">As</span> Exception</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'mostramos el error</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">If</span> <a href="http://www.google.com/search?q=ERR+msdn.microsoft.com"><span style="color: #008000;">Err</span></a>.<span style="color: #0000FF;">Number</span> = <span style="color: #FF0000;color:#800000;">91</span> Or <a href="http://www.google.com/search?q=ERR+msdn.microsoft.com"><span style="color: #008000;">Err</span></a>.<span style="color: #0000FF;">Number</span> = <span style="color: #FF0000;color:#800000;">5</span> <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;No se encontro registro&quot;)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=ERR+msdn.microsoft.com"><span style="color: #008000;">Err</span></a>.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #FF8000;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">"error "</span> &amp; <a href="http://www.google.com/search?q=ERR+msdn.microsoft.com"><span style="color: #008000;">Err</span></a>.<span style="color: #0000FF;">Number</span>.<span style="color: #0000FF;">ToString</span> &amp; vbCrLf &amp; ex.<span style="color: #0000FF;">Message</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">'Finally</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Try</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://ayuda.fotopex.com/programacion/net/escribir-datos-de-un-oledbdatareader-a-un-archivo-de-texto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
