Hi Everyone,
I would appreciate it if someone could have a look at this short mysqli script and tell my why I am getting this parse error:
Parse error: syntax error, unexpected T_VARIABLE in /home/james230/public_html/xampp/htdocs/lesson1/login.php on line 10
I had this set up as mysql and it works perfectly, but I have to have it work under mysqli for the course I am doing. I know that it sounds crazy but for some reason I have a lot of problems doing the mysqli change over and would really appreciate some help here.
<?php
session_start();
include ('mysqli.php');
echo "<pre>";
var_dump($_POST);
echo "</pre>";
if (isset ($_POST['submit'])) {
$username = mysqli_real_escape_string($link,$select)$_POST['username']));
$password = mysqli_real_escape_string($link,$select)$_POST['password']));
if(!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if (!empty ($username) && !empty ($password)) {
$link = mysqli_query ("SELECT * FROM Customer
WHERE username='$username' AND
password='$password' LIMIT 1");
if (mysqli_num_rows ($result) > 0) {
$_SESSION['loggedin'] = true;
$_SESSION['username'] = $username;
echo 'You are now logged in! <br />
Please proceed to the
<a href="http://www.professorofprofit.com/xampp/htdocs/lesson1/members.php">
Members Only Page</a>';
} else {
echo 'Your username and/or password is incorrect.<br /> If you do not have one, please go <a href= "http://www.professorofprofit.com/xampp/htdocs/lesson1/register.php">
HERE</a> and register to become a member. Thank you...!';
}
} else {
echo 'You must enter a username and a password!';
}
} else {
include ('two_forms.inc');
}
?>
I am going to include the connect script in case it is in this area that the problem is happening.
<?php
ini_set("display_errors","on");
error_reporting(E_ALL | E_STRICT);
ini_set("include_path","./includes");
$link = mysqli_connect($host,$user,$passwd, $dbname)
or die("error connecting to database!".mysqli_error($cxn));
$select = mysqli_select_db($link,$dbname) or die ('error selecting database!'.mysqli_error());
?>
I appreciate anyone taking the time to help me with this. I hope to return the favor sometime. Have great day everyone.
fridge2305