I need serious help my my sql statement. First, for some reason the default values for bio and user_image are not inserting. Second, my statement works on and off. Sometimes it inserts, sometimes it doesn't. I need some smart person help. Thanks in advance. Heres my code:
$query = "INSERT INTO users VALUES ('{$_POST['display_name']}', '{$_POST['email']}','{$_POST['password']}','active','{$_POST['first_name']}','{$_POST['last_name']}',DEFAULT,DEFAULT)";
mysql_query($query);
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=success.php">';
exit;
Messed up I know, im doing this project to learn more about databases. Heres my db structure:
Field Type Null Default
id int(11) No
username varchar(255) No
email varchar(255) No
password varchar(255) No
status enum('active', 'inactive') No
first_name text No
last_name text No
bio varchar(305) No HEY! theres nothing here yet ....Complete your bio if you want to get rid of this lame placeholder text. Use this space on your page to tell the internet a little bit about yourself. Or just make everyone feel bad by listing all of your amazing accomplishments! I prefer the latter.
user_image varchar(305) No user_profile.jpg
**Changed but still not working:
$query = "INSERT INTO users(username, email, password, first_name,last_name)
VALUES ({$_POST['display_name']}, {$_POST['email']}, {$_POST['password']}, {$_POST['first_name']}, {$_POST['last_name']})";