Very simply, how can check if a user exists against my MySQL database?

Posted by Sergio Tapia on Stack Overflow See other posts from Stack Overflow or by Sergio Tapia
Published on 2010-06-01T00:55:54Z Indexed on 2010/06/01 1:03 UTC
Read the original article Hit count: 493

Filed under:
|
|

Here's what I have but nothing is output to the screen. :\

<html>
<head>
</head>
<body>
<? 
mysql_connect(localhost, "sergio", "123");
@mysql_select_db("multas") or die( "Unable to select database");

$query="SELECT * FROM usuario";
$result=mysql_query($query);

$num=mysql_numrows($result);
$i=0;

$username=GET["u"];
$password=GET["p"];

while ($i < $num) {

$dbusername=mysql_result($result,$i,"username");
$dbpassword=mysql_result($result,$i,"password");

if(($username == $dbusername) && ($password == $dbpassword)){
echo "si";
}

$i++;
}

?>
</body>
</html>

I'm iterating through all users and seeing if there is a match for user && password.

Any guidance?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql