The full error is:
Parse error: syntax error, unexpected T_STRING in .../cgi-bin/register_login.php on line 33
The code is set to check if an email exists in the MySQL database.
If the email does exist, then it checks the password and if both agree loads the users account into an array.
If the email does not exist, then it updates the database with the email address and password inputted.
The code follows below:
<?php
/*COPYING VARIABLES FROM LOGIN FORM INTO PHP TO CHECK TO DATABASE*/
$email=$_POST["email"];
$password=$_POST["password"];
/*OPEN THE DATABASE*/
$con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
/*CHECK FOR EMAIL ADDRESS IN WEBBASE DATABASE*/
$fields = mysql_list_fields("my_db","accounts");
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++)
{
$field_array[] = mysql_field_name($fields, $i);
}
if (in_array($email,$field_array))
{
/*ACCOUNT EXISTS SO LOG THE USER IN...*/
$passwordcheck= "SELECT * FROM "accounts" WHERE (("email" = "$email") AND ("password" = "$password"))";
if (mysql_qery($passwordcheck,$con))
{
/*INSERT THE EDIT SCRIPT HERE*/
$profile = mysql_fetch_array($passwordcheck);
}
else
{
echo "Incorrect password. Please try again.";
}
}
else
{
/*...OR CREATE A NEW ACCOUNT IF THE ACCOUNT DOES NOT EXIST*/
$adduser= "INSERT INTO "accounts" ("email", "password") VALUES ("$email", "$password"));
mysql_query($adduser);
}
$get_id= "SELECT idnum FROM accounts WHERE (("email" = "$email") AND ("password" = "$password"))";
$idnum=mysql_query($get_id);
/*CLOSE THE DATABASE*/
mysql_close($con);
?>
...so what's wrong...? This might be a newbie question, but I only started learning LAMP a month or so ago...
Any help would be appreciated!