Skip to content

Instantly share code, notes, and snippets.

@FraGoTe
Last active August 29, 2015 14:01
Show Gist options
  • Save FraGoTe/0bbdc59dc47f2e734705 to your computer and use it in GitHub Desktop.
Save FraGoTe/0bbdc59dc47f2e734705 to your computer and use it in GitHub Desktop.
<?php
//Conexion a la base de datos
mysql_connect("localhost","usuarioBaseDeDatos","claveBaseDeDatos");
mysql_select_db("nombreDeLaBaseDeDatos");
//Fin de la conexión a la base de datos
$username = "aragonc";
$password = "admin";
//Query a la tabla user filtrando por username y password
$sql="SELECT * FROM user WHERE (username='$username' AND password='$password')";
$res = mysql_query($sql);
$row = mysql_fetch_array($res);
if( mysql_query($sql) ) {
;
// ok!
} else {
echo "Has tenido el siguiente error:<br />".mysql_error();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment