Skip to content

Instantly share code, notes, and snippets.

@tanrax
Created February 13, 2014 09:10
Show Gist options
  • Save tanrax/8972076 to your computer and use it in GitHub Desktop.
Save tanrax/8972076 to your computer and use it in GitHub Desktop.
PHP: Consulta MySQL (SQL)
<?php
/* Conexion */
$conexion = mysql_connect('localhost', 'root', '');
mysql_select_db('nombreBBDD', $conexion);
/* Consulta */
$sSQL = "SELECT * FROM";
$resultados = mysql_query($sSQL, $conexion) or die(mysql_error());
/* Obtener datos */
while($row = mysql_fetch_assoc($resultados)) {
echo $row['id'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment