bilis_money Posted August 7, 2006 Share Posted August 7, 2006 hii'm now trying to insert the datas into a tablewith field 'activated' and was set as ENUM.remember that 'activated' column field is ENUM.is this correct?[code]$query = "INSERT INTO users (first_name, last_name, username, password, email_address, signup_date, activated) VALUES ('$fname', '$lname', '$user', '$password', '$email', '1')";mysql_query($query) or die('Error, insert query failed');[/code]Your help will be appreciated much.Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/16791-inserting-into-table-with-enum-value-the-right-way/ Share on other sites More sharing options...
Daniel0 Posted August 7, 2006 Share Posted August 7, 2006 Yeah that should work. Link to comment https://forums.phpfreaks.com/topic/16791-inserting-into-table-with-enum-value-the-right-way/#findComment-70651 Share on other sites More sharing options...
wildteen88 Posted August 7, 2006 Share Posted August 7, 2006 Yes that is fine. ENUM only accepts the values you provided when you created the table. So if you did this when creating the users table:[code]CREATE TABLE users (-- rest of fields here --activated ENUM('0','1') DEFAULT '0'-- rest of query here --)[/code]Then the activated field will only accept 0 or 1 as the value. if the value given was not 0 or 1 it'll use the default value which was 0. Link to comment https://forums.phpfreaks.com/topic/16791-inserting-into-table-with-enum-value-the-right-way/#findComment-70693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.