jackr1909 Posted April 10, 2011 Share Posted April 10, 2011 CREATE TABLE `members` ( `id` int(4) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `password` varchar(65) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; Hi, i would like to add values automattically from a form that my users fill out that corresponds to their login details. The form templete is above. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/233244-automated-adding-of-values-to-tables/ Share on other sites More sharing options...
vicodin Posted April 10, 2011 Share Posted April 10, 2011 You can make a default value for a field if nothing is inserted into it. http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html Quote Link to comment https://forums.phpfreaks.com/topic/233244-automated-adding-of-values-to-tables/#findComment-1199553 Share on other sites More sharing options...
blacknight Posted April 10, 2011 Share Posted April 10, 2011 for your members security you should allways md5 there passwords $query = "INSERT INTO `members` SET (`username`,`password`) VALUES ('".$username."','".md5($password)."')"; that will insert the info. when you set a field to not null you dont need to set a default value because you have to set the value. Quote Link to comment https://forums.phpfreaks.com/topic/233244-automated-adding-of-values-to-tables/#findComment-1199568 Share on other sites More sharing options...
PFMaBiSmAd Posted April 10, 2011 Share Posted April 10, 2011 While you might have a database table definition (that's not a form template), your question is programming related. So, moving this thread to the php coding forum ... The mysql forum section is for problems using mysql, such as a query that produces an error. Getting the data from a form and inserting it into a database table is a very common task and there are countless php code examples posted all over the Internet showing how to do this. Sorry to repeat, but you should be asking for help with specific problems or errors with your code or query. If you don't have any code and are just listing what you want to do "i would like to add values automatically ..." then you need to first attempt to create or find code that does what you want and try to accomplish your stated goal. Quote Link to comment https://forums.phpfreaks.com/topic/233244-automated-adding-of-values-to-tables/#findComment-1199629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.