Hi
I am trying to write a (very) basic script to compare data retrieved from a form with a mySQL database. In this case it is a simple name and password entry - if there is a corresponding entry in the database, then it prints a simple sucess message, and if not a failure messge.....
The script looks like this, and I get ' parse error, line 25,( somewhere after $query)
Any ideas?
<?php>
// compares values entered in login page form with mySQL database, and then directs either to protected page or to a failure page
$fn = trim($_POST['nameone']);
$pw = trim($_POST['password']);
$link = mysql_connect ('localhost', 'root', 'purple');
mysql_select_db ("phptest");
// if $fn and $pw match a record, then display page, else display failure page
$query = "SELECT firstname, password FROM mailinglist WHERE (firstname = '$fn' AND password = '$pw')";
$result = mysql_query ($query, $link);
if (mysql_num_rows($result) == 1) {
print 'Good to go' ;
} else {
print 'Sorry, this login is invalid' ;
}