Este es mi código PHP:
Código PHP:
<?php
$usu = $_POST["txt_usuario"];
$pass = $_POST["txt_password"];
$db = new mysqli("localhost", "miUsuario", "miContra", "miBD") or die("Error");
$stmt = $db->prepare("SELECT id FROM datos_empresa WHERE nom_empresa = ? AND rfc = ?");
$stmt->bind_param('ss', $usu, $pass);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows == 1) {
$stmt->bind_result($id);
$stmt->fetch();
$stmt = $db->prepare("UPDATE datos_empresa SET last_login = NOW() WHERE id = ?");
$stmt->bind_param('d', $id);
$stmt->execute();
header('Location: http://android.neosoftware.org.mx/index.html#pag_principal');
} else {
echo "Error.";
}
?>
Código HTML:
<div data-role = "page" id = "login"> <div data-role = "header" data-theme = "b" data-position = "fixed" class="encabezado"> <h1> Iniciar sesión </h1> </div> <div data-role = "content" data-theme = "b"> <form action = "login.php" enctype="application/x-www-form-urlencoded" method="post"> <label for = "lgn_usuario"> Nombre usuario: </label> <input type = "text" name = "txt_usuario" data-theme = "c" placeholder = "Usuario"> <label for = "password"> Contraseña: </label> <input type = "password" name = "txt_password" data-theme = "c" placeholder = "Contraseña"> <div class = "ui-grid-a"> <div class = "ui-block-a"><input name="login" type="submit" value="Ingresar" data-icon="check" data-theme="a"></div> <div class = "ui-block-b"><a href = "#" data-role = "button" id = "btn_limpiar_campos" data-theme = "a" data-icon = "delete"> Limpiar </a></div> </div> </form> </div> </div>
Espero que puedan ayudarme a resolver mi problema, muchas gracias.