Hi, I have a simple login and logout system but I want the users to be able to register themselves onto the database.
I have looked at some code to do this but none of it works as im fairly new to PHP.
I am getting error "Column count doesn't match value count at row 1"
This is the action php code
and this is the user interface codePHP Code:<?PHP
// register2.php
include("config.inc");
$errors = "";
if (!isset($_POST['username']))
$errors .= "Please provide a username. <br/>";
if (!isset($_POST['password']))
$errors .= "Please provide a password. <br/>";
if ($errors == "") {
mysql_query("INSERT INTO user_list VALUES(
'',
'".addslashes($_POST['username'])."',
'".md5($_POST['password'])."',
'".time()."'
)") or die(mysql_error());
echo "Registration Successful!";
} else {
echo $errors."Please go back and try again.";
}
?>
PHP Code:
<!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>Untitled Document</title>
</head>
<body>
<!-- Register Page -->
<form method="post" action="reg2.2.php">
Username<br/><input type="text" name="username" maxlength="20" /><br/>
Password<br/><input type="password" name="password" /><br/>
<input type ="submit" />
</form>
</body>
</html>



Reply With Quote
Bookmarks