Hello all,
Just wondering if I could pick some brains, I'm currently learning PHP and have been messing around with a fun project, currently developing a simple login / register script.
The error that I keep getting is -
Parse error: syntax error, unexpected T_ELSE in /home/danhumph/public_html/smithy/login.php on line 27
Can't for the life of me work out what's missing in this code:
<?php
//connect to db
$conn = mysql_connect("localhost", "blah", "blah") or die(mysql_error());
mysql_select_db("blah") or die(mysql_error());
//declares variable
$username=$_POST["username"];
$password = $_POST["password"];
$result = mysql_query ("SELECT * FROM users WHERE username = '$username' AND password = '$password' AND isadmin = '$isadmin'");
$isadmin = mysql_query ("SELECT * FROM users WHERE username = '$username' AND password = '$password' AND isadmin = '$isadmin'");
if (mysql_num_rows($result)==0) {
echo "No matching rows from the database!"; }
while ($row = mysql_fetch_array($isadmin)){
if
($row["isadmin"]==1);
echo "You are logged in as administrator" or die(mysql_error());
}
else
$_SESSION["gatekeeper"] = $username;
header ("Location: index.php");
?>
Thanks in Advance,
Dan.