Could anyone help me with this problem. I'm new to php so dont really know wot i'm doing!! I'm trying to log in
My code is below
<?PHP
print_r($HTTP_POST_VARS);
$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];
$connection=mysql_connect("localhost","pp","mm")
or die('Could not connect to the database server');
$rs = mysql_select_db("test", $connection)
or die ("Unable to select database.");
$sql="select from firsttimevoter where username='" . $HTTP_POST_VARS['username'] . "' and password= password('" . $HTTP_POST_VARS['password'] . "')";
print $sql;
$rs = mysql_query($sql, $connection) or die (mysql_error());
#get number of rows that match username and password
$num=mysql_numrows($rs);
#if there is a match the log in is authenticated
if($num!=0)
{ $msg="Welcome $username - your log-in succeeded!"; }
else #return to login page
{ header("Location:$HTTP_REFERER"); exit();}
?>
<HTML>
<HEAD><TITLE>Log-In authenticated</TITLE></HEAD><BODY>
<?php echo($msg); ?></BODY>
</HTML>
THe following is coming up
Array ( [username] => bob [password] => bob ) select from firsttimevoter where username='bob' and password= password('bob')You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from firsttimevoter where username='bob' and password= password
Any help would be greatly appreciated