
13/01/2012, 07:36
|
| | Fecha de Ingreso: diciembre-2011
Mensajes: 414
Antigüedad: 13 años, 4 meses Puntos: 1 | |
Problemas en la parte del login Despues de conseguir el envío de datos a la bd me ha surgido problemas con la parte del login..
<?php
ob_start();
include("config.php");
// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());
// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error()); $match = "select id from $table where username = '".$_POST['username']."'
and password = '".$_POST['password']."';";
$qry = mysql_query($match)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows <= 0) {
echo "Sorry, there is no username or password with: <strong>".$_POST['username']."</strong><br>";
echo "<a href=login.html>Try again</a>";
exit;
} else {
setcookie("loggedin", "".$_POST['username']."", time()+(3600 * 24));
echo "Welcome: <strong>".$_POST['username']."</strong><br>";
echo "Continue to the <a href=members.php>members</a> section.";
}
ob_end_flush();
?>
La parte que está en negrita es la causante del error y este es el error vale dice que no existe el username pero cuando
Could not match data because Unknown column 'username' in 'where clause'
Asi que canvio los errores de la siguiente manera
$match = "select id from $table where mail = '".$_POST['mail']."'
and password = '".$_POST['password']."';";
y me sale igual :( |