Here is the code I'm using:
CODE
<?php
include ('db_var.php');
if ($_POST) {
$user=$_POST['user_name'];
$password=$_POST['password'];
$confirm=$_POST['confirmpw'];
$affiliation=$_POST['affiliation'];
$admin='N';
$subscription='N';
$beta_test='N';
$email=$_POST['email'];
$points=0;
$wins=0;
$losses=0;
$rank='Ensign';
if ($password != $confirmpw) {
print(" <span style='color:red'>ERROR: Passwords do not match! </span>");
}
else
{
$mysqli = new mysqli($host, $user, $pw, $db);
if ( $mysqli->errno)
{
printf("Unable to connect to the database: <br /> %s", $mysqli->error);
exit();
}
$query = "SELECT COUNT(id) FROM users WHERE user_name = $user";
$result= $mysqli->query($query, MYSQLI_STORE_RESULT);
list($count) =$result->fetch_row();
if ($count >= 1) {
print(" <span style='color:red'>ERROR: Username is not available! </span>");
}
else
{
$query = "INSERT INTO users (`user_name` ,`password` ,`affiliation` ,`admin` ,`subscription` ,`beta_test` ,
`email` ,`points` ,`wins` ,`losses` ,`rank`) VALUES (
'$user','$password', '$confirm', '$affiliation', '$admin', '$subscription', '$beta_test','$email','$points','$wins','$losses', '$rank')";
$result=$mysqli->query($query, MYSQLI_STORE_RESULT);
$result->free();
}
?>
<html>
<body>
<form method='post' action='register.php'>
Username: <input type='text' name='user_name' /><br />
Password: <input type='password' name='password' /><br />
Confirm Password: <input type='password' name='confirmpw' /><br />
affiliation: <input type='text' name='affiliation' /><br />
Email: <input type='text' name='email' /> <br />
<br />
<input type='submit' value='Register!' />
</form>
</body>
</html>
I'm getting:
Parse error: syntax error, unexpected $end in /home/rich/public_html/register.php on line 81
I've gone through this several times to see if I'm missing a single or double quote or a missing ; somewhere. And I'm not seeing anything. I'm sure I'm missing something ultra-obvious here.
anyone see something I'm missing?