<?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>Mas que Wordpress &#187; base de datos</title>
	<atom:link href="http://www.masquewordpress.com/tag/base-de-datos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masquewordpress.com</link>
	<description>Tutoriales y recursos web sobre JQuery , PHP, Wordpress , twitter. Aprende diseño web y programación</description>
	<lastBuildDate>Sat, 19 May 2012 17:05:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Como elegir contraseñas seguras y faciles de recordar</title>
		<link>http://www.masquewordpress.com/elegir-contrasenas-seguras/</link>
		<comments>http://www.masquewordpress.com/elegir-contrasenas-seguras/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 01:44:29 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[base de datos]]></category>
		<category><![CDATA[contraseñas]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=674</guid>
		<description><![CDATA[Hoy a través de mi twitter me llego un link de Firefox dando algunos consejos para elegir una contraseña segura que me pareció muy interesante y que me gustaría compartir con ustedes. Con tan solo 3 pasos podremos tenes una contraseña más segura y fácil de recordar, y así evitar posibles problemas con robos de [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy a través de mi <a href="http://twitter.com/chifliiiii">twitter</a> me llego un link de Firefox dando algunos consejos para elegir una contraseña segura que me pareció muy interesante y que me gustaría compartir con ustedes.</p>
<p>Con tan solo 3 pasos podremos tenes una contraseña más segura y fácil de recordar, y así evitar posibles problemas con robos de <a href="http://masquewordpress.com/tutoriales/como-proteger-a-tus-usuarios-cuando-te-hackean-la-base-de-datos/">base de datos poco seguras</a>.</p>
<h3><span id="more-674"></span>1. Elegir una frase</h3>
<p>Podemos empezar eligiendo una frase simple como &#8220;Al que madruga Dios lo ayuda&#8221; .</p>
<p>Si de esta frase elegimos las primeras letras obtenemos:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">AqmDla</pre></div></div>

<h3>2. Agregar algunos caracteres especiales</h3>
<p>Aunque nuestra contraseña no es común todavía es fácil de averiguar mediante un ataque de fuerza bruta, por lo que agregar un par de caracteres especiales mejoraría la calidad.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#AqmDla:</span></pre></div></div>

<h3>3. Asociar la contraseña con los sitios web</h3>
<p>Por último agregando prefijos o sufijos podemos usar la contraseña para los diferentes sitios que solemos visitar y así usar diferentes contraseñas , complejas, únicas y fáciles de recordar.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#AqmDla:fbk Para el facebook
</span>
<span style="color: #666666; font-style: italic;">#AqmDla:twt Para el Twitter
</span>
Yout<span style="color: #666666; font-style: italic;">#AqmDla: Para el Youtube</span></pre></div></div>

<p>Y así todas las variantes que se les ocurran. ¿No les parece una buena forma de crear contraseñas seguras y fáciles de recordar? ¿Usan algún otro método?</p>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/516ffa1373c8295d2e5ff5267fc53399?s=100&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D100&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.masquewordpress.com/author/Damian/' title='Damian'>Damian</a></h3><p>Programador en tiempos libres , amante de la tecnología, blogger amateur y emprendedor en sueños.</p><p><a href='http://www.masquewordpress.com/author/Damian/' title='M&aacute;s post de Damian'>M&aacute;s Posts de Damian</a>  - <a href='http://www.timersys.com' title='Damian'>Web</a> </p><p class="wpa-nomargin">Sigueme:<br /><a class='wpa-social-icons' href='http://www.twitter.com/chifliiiii'><img src='http://www.masquewordpress.com/wp-content/plugins/wp-about-author//images/twitter.png' alt='Twitter'/></a><a class='wpa-social-icons' href='http://www.facebook.com/pages/Timersys/146687622031640'><img src='http://www.masquewordpress.com/wp-content/plugins/wp-about-author//images/facebook.png' alt='Facebook'/></a><a class='wpa-social-icons' href='http://ar.linkedin.com/pub/damian-logghe/26/173/321'><img src='http://www.masquewordpress.com/wp-content/plugins/wp-about-author//images/linkedin.png' alt='LinkedIn'/></a></p></p>]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/elegir-contrasenas-seguras/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>DB.php : Como definir los parametros de conexión de tu base de datos</title>
		<link>http://www.masquewordpress.com/dbphp-como-definir-los-parametros-de-conexion-de-tu-base-de-datos/</link>
		<comments>http://www.masquewordpress.com/dbphp-como-definir-los-parametros-de-conexion-de-tu-base-de-datos/#comments</comments>
		<pubDate>Sun, 24 May 2009 18:49:59 +0000</pubDate>
		<dc:creator>Damian</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutoriales]]></category>
		<category><![CDATA[base de datos]]></category>

		<guid isPermaLink="false">http://masquewordpress.com/?p=58</guid>
		<description><![CDATA[En mis diseños siempre defino los valores de conexión a la base de datos en un archivo php llamado db.php  (database name, username, password, database host), de forma que cada vez que necesito conectarme tan solo tengo que hacer un include del mismo. Una vez que tengamos creado nuestra base de datos a traves de [...]]]></description>
			<content:encoded><![CDATA[<p>En mis diseños siempre defino los valores de conexión a la base de datos en un archivo php llamado <strong>db.php</strong>  (database name, username, password, database host), de forma que cada vez que necesito conectarme tan solo tengo que hacer un include del mismo.</p>
<p>Una vez que tengamos creado nuestra base de datos a traves de phpMyAdmin o desde nuestro gestor en el hosting, tan solo tenemos que crear este archivo, que es muy sencillo y solo ocupa unas lineas.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #666666; font-style: italic;">//datos de conexion que hay que editar con los que corresponda</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_IP'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'unnombredeusuario'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'unpassword'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'nombredelabasededatos'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// Funcion que vamos a usar para realizar la conexion (Acá no se edita nada)</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000000; font-weight: bold;">function</span> get_db_conn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_IP'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No pudo conectarse a la BD: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$conn</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Con eso ya tendriamos los datos de conexión listos, aunque yo siempre agrego una pequeña funcion para proteger los datos de inyección SQL (o como dicen en ingles SQL INJECTIONS).Por lo que me aseguro que cada vez que carga una conexion , cargo también la funcion que me va a ayudar a protegerme.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//PARA PROTEGER SQL INJECT</span>
<span style="color: #000000; font-weight: bold;">function</span> cleanQuery<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">get_magic_quotes_gpc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>   <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">phpversion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #0000ff;">'4.3.0'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$string</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Por lo tanto nuestro archivo db.php queria de la siguiente manera:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_IP'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'unnombredeusuario'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'unpassword'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'nombredelabasededatos'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// Database queries</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000000; font-weight: bold;">function</span> get_db_conn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_IP'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No pudo conectarse a la BD: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$conn</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//PARA PROTEGER SQL INJECT</span>
<span style="color: #000000; font-weight: bold;">function</span> cleanQuery<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">get_magic_quotes_gpc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>  <span style="color: #666666; font-style: italic;">// prevents duplicate backslashes</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">phpversion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #0000ff;">'4.3.0'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$string</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Una vez armado el db.php , solo nos queda incluirlo en nuestras páginas. y lo haremos de la siguiente manera:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Una vez incluido nuestro archivo podemos realizar una nueva conexión de la siguiente forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Creamos la variable $conn y le asignamos la conexión a la base de datos</span>
<span style="color: #000088;">$conn</span><span style="color: #339933;">=</span>get_db_conn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>La función <strong>cleanQuery</strong> la vamos a usar para &#8220;limpiar&#8221; las variables. Si juntamos todo los visto anteriormente y suponiendo que tenemos un archivo llamado busquedas.php al cual le pasamos una variable $_GET['pelicula'] podriamos dejar el código de la siguiente manera:</p>
<p>EJ:<strong>busquedas.php?pelicula=killBill</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conn</span><span style="color: #339933;">=</span>get_db_conn<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nombrePelicula</span><span style="color: #339933;">=</span> cleanQuery<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pelicula'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$consulta</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT * FROM peliculas WHERE nombre='<span style="color: #006699; font-weight: bold;">$nombrePelicula</span>'&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$peliculas</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$consulta</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$peliculas</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Invalid query: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//la consulta se ejecuto correctamente y mostramos los datos</span>
   <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;table&gt;&lt;thead&gt;
        &lt;tr&gt;&lt;th&gt;Título&lt;/th&gt;&lt;th&gt;Director&lt;/th&gt;&lt;th&gt; Año de producción&lt;/th&gt;&lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> mysql_fecth_assoc<span style="color: #009900;">&#40;</span><span style="color: #000088;">$peliculas</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;tr&gt;&lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nombre'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;/td&gt;&lt;td&gt; <span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'director'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;/td&gt;&lt;td&gt; <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'año'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;/td&gt;&lt;/tr&gt;
       <span style="color: #000000; font-weight: bold;">&lt;?</span>  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;/tbody&gt;
      &lt;/table&gt;</pre></td></tr></table></div>

<p>Esta sería la forma sencilla de configurar las conexiones a una base de datos. Por favor comenten cualquier duda que vaya surgiendo. Un Saludo</p>
<h4><a href="http://masquewordpress.com/ejemplos/db.rar">Descargar db.php</a></h4>
<p><div style="float:left; text-align:left;><img alt='' src='http://1.gravatar.com/avatar/516ffa1373c8295d2e5ff5267fc53399?s=100&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D100&amp;r=G' class='avatar avatar-100 photo' height='100' width='100' /></div><h3><a href='http://www.masquewordpress.com/author/Damian/' title='Damian'>Damian</a></h3><p>Programador en tiempos libres , amante de la tecnología, blogger amateur y emprendedor en sueños.</p><p><a href='http://www.masquewordpress.com/author/Damian/' title='M&aacute;s post de Damian'>M&aacute;s Posts de Damian</a>  - <a href='http://www.timersys.com' title='Damian'>Web</a> </p><p class="wpa-nomargin">Sigueme:<br /><a class='wpa-social-icons' href='http://www.twitter.com/chifliiiii'><img src='http://www.masquewordpress.com/wp-content/plugins/wp-about-author//images/twitter.png' alt='Twitter'/></a><a class='wpa-social-icons' href='http://www.facebook.com/pages/Timersys/146687622031640'><img src='http://www.masquewordpress.com/wp-content/plugins/wp-about-author//images/facebook.png' alt='Facebook'/></a><a class='wpa-social-icons' href='http://ar.linkedin.com/pub/damian-logghe/26/173/321'><img src='http://www.masquewordpress.com/wp-content/plugins/wp-about-author//images/linkedin.png' alt='LinkedIn'/></a></p></p>]]></content:encoded>
			<wfw:commentRss>http://www.masquewordpress.com/dbphp-como-definir-los-parametros-de-conexion-de-tu-base-de-datos/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

