I'm trying to create a page where i can add new users to a database
my code is
<?php
$connection = mysql_connect("***","***","***"); // Mysql Connection
if (!$connection)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("***", $connection);
$sql="INSERT INTO 'users' (id, username, hashed_password, full_name)
VALUES ( NULL, '$_POST[username]','$_POST[hashed_password]', '$_POST[fullname]')";
if (!mysql_query($sql,$connection))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($connection)
?>
<!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=utf-8" />
<title>Add New User</title>
</head>
<body>
<form action="add_user.php" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="hashed_password" /><br />
Fullname: <input type="text" name="fullname" /><br />
<input type="submit" />
</form>
</body>
</html>I have ***'s out my login details and database name, but can anyone see why i get an error when i load the page
I look forward to hearing your response
Kind Regards
Shane
Help




















