It keeps saying there is not an account registered by the username even though there is. I just need a refresher on how to make a database insert. Thanks, Sacreed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Check</title>
<style type="text/css">
body
{
background-image:url("bat background.gif");
}
p
{
color:yellow;
text-align:center;
font-family:"Times New Roman";
font-size:15px;
}
a
{
color:yellow;
text-align:center;
font-family:"Times New Roman";
font-size:15px;
}
</style>
</head>
<body>
<?php include("menu.php"); ?>
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$username = $_POST['user'];
$password = $_POST['pass'];
$result = mysql_query("SELECT" . $username . "FROM users");
if ($result != 0)
{
echo "<p>That username is taken</p>";
echo "<p>Go <a href=register.php>here</a> to try a different username</p>";
}
if ($result != 1)
{
mysql_query("INSERT INTO users (Username, Password)
VALUES('" . $username . "','" . $password . "')");
echo "<p>Thanks for registering!</p>";
echo "<p>Go <a href=login.php>here</a> to log in</p>";
}
mysql_close($con);
?>
</body>
</html>