Created
April 30, 2015 10:35
-
-
Save manviny/1b0a0e348bbf3e022f83 to your computer and use it in GitHub Desktop.
conexion BD desde PHP con mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// // 1.- mysql -u root -p | |
$enlace = mysql_connect('localhost', 'bn_processwire', 'd1ac70ac0d' ); | |
if (!$enlace) { | |
die('No pudo conectarse: ' . mysql_error()); | |
} | |
echo 'Conectado satisfactoriamente'; | |
// 2.- use mydatabase | |
mysql_select_db('bitnami_processwire') or die("No se pudo conectar a esa BD"); | |
// 3.- SELECT * FROM templates | |
$query = 'SELECT * FROM templates'; | |
$result = mysql_query($query) or die ("Consulta fallida"); | |
while($line=mysql_fetch_array($result)){ | |
echo '<br>'.$line['name']; | |
} | |
// exit | |
mysql_close($enlace); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment