MySQL interesse |
|
Hallo allemaal,
ik zit met het volgende probleem ik snap het niet van alles geprobeerd, altyd werkte het en nu krijg ik gewoon foutmelding...
ik heb een registratie form en db table "users" nu als ik op registeren druk, krijg ik de volgende fout:
"Field 'hash' doesn't have a default value".
ik codeer gewoon zoals ik altyd codeer en nu in 1keer wilt het niet meewerken .
users.sql:
CREATE TABLE users (
id int(10) auto_increment NOT NULL,
username varchar(16) NOT NULL,
firstname varchar(100) NOT NULL,
lastname varchar(100) NOT NULL,
password varchar(32) NOT NULL,
email varchar(100) NOT NULL,
rank varchar(10) NOT NULL default '5',
birthdate DATE NOT NULL,
location varchar(100) NOT NULL,
country varchar(100) NOT NULL,
regip varchar(255) NOT NULL,
hash varchar(15) NOT NULL,
ip varchar(255) NOT NULL,
primary key(id)
) TYPE=MyISAM;
CREATE TABLE users ( id int(10) AUTO_INCREMENT NOT NULL, username varchar(16) NOT NULL, firstname varchar(100) NOT NULL, lastname varchar(100) NOT NULL, password varchar(32) NOT NULL, email varchar(100) NOT NULL, rank varchar(10) NOT NULL DEFAULT '5', birthdate DATE NOT NULL, location varchar(100) NOT NULL, country varchar(100) NOT NULL, regip varchar(255) NOT NULL, hash varchar(15) NOT NULL, ip varchar(255) NOT NULL, PRIMARY KEY(id) ) TYPE=MyISAM;
de insert van registration.php:
$birthdate = $_POST['birth_year']."-".$_POST['birth_month']."-".$_POST['birth_day'];
mysql_query('INSERT INTO users (
username,
firstname,
lastname,
password,
email,
rank,
birthdate,
location,
country,
regip
) VALUES (
"'.$_POST['username'].'",
"'.$_POST['firstname'].'",
"'.$_POST['lastname'].'",
"'.md5($_POST['password']).'",
"'.$_POST['email'].'",
"1",
"'.$birthdate.'",
"'.$_POST['location'].'",
"'.$_POST['country'].'",
"'.$_SERVER['REMOTE_ADDR'].'"
)') or die(mysql_error());
$tpl->newBlock('successful');
$tpl->assign('message', 'You have been successfully added to the database, You can login now!');
$birthdate = $_POST['birth_year']."-".$_POST['birth_month']."-".$_POST['birth_day']; username, firstname, lastname, password, email, rank, birthdate, location, country, regip ) VALUES ( "'.$_POST['username'].'", "'.$_POST['firstname'].'", "'.$_POST['lastname'].'", "'.md5($_POST['password']).'", "'.$_POST['email'].'", "1", "'.$birthdate.'", "'.$_POST['location'].'", "'.$_POST['country'].'", "'.$_SERVER['REMOTE_ADDR'].'" $tpl->newBlock('successful'); $tpl->assign('message', 'You have been successfully added to the database, You can login now!');
|