Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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