jassikundi Posted February 5, 2008 Share Posted February 5, 2008 Hi everyone, I was wondering if someone could point me in the right direction of a PHP method of storing data into a database. I've created my form but would like to find a good tutorial for the post method. The form contains asks for basic info e.g. name, email, address for a business website. Thanks in Advance Regards Jassi Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/ Share on other sites More sharing options...
revraz Posted February 5, 2008 Share Posted February 5, 2008 http://www.freewebmasterhelp.com/tutorials/phpmysql/4 Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-458931 Share on other sites More sharing options...
dennismonsewicz Posted February 5, 2008 Share Posted February 5, 2008 Try this website: http://www.w3schools.com/php/php_mysql_insert.asp Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-458932 Share on other sites More sharing options...
jassikundi Posted February 5, 2008 Author Share Posted February 5, 2008 Hi thanks for that, right I've got a question, the system I'm creating now for a family business allows users to register sign up login etc and view a control panel that allows them to edit their password etc (very basic). The table for the user registration is: CREATE TABLE users ( username varchar(30) primary key, password varchar(32), userid varchar(32), userlevel tinyint(1) unsigned not null, email varchar(50), timestamp int(11) unsigned not null ); Which works fine for me, now if I wanted to allow users to first register login to control panel and follow a link to submit a get quote for a kitchen bedroom design. Would it be ideal to create a new table or add more values such as address, contact number etc to the current users table above. Regards Jassi Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-458977 Share on other sites More sharing options...
jsleepn Posted February 5, 2008 Share Posted February 5, 2008 That would depend on a few variables. Will a user have many addresses? eg, one user owns more than one house and will need work done on 2 different kitchens. are your users contractors, if yes there will be many contracts with different addresses. I would say create a new table : contract : since the probability of one to many relationship is high. Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-458996 Share on other sites More sharing options...
jassikundi Posted February 5, 2008 Author Share Posted February 5, 2008 Ok I understand what your saying seems logical, and I think I can manage that. For all the quotes submitted would I be able to record into the database who submitted them, from their email address or login name? If so how would I do this? I'm guessing that I'd need to store their email address as a primary key maybe on the new contracts database? ??? Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-459011 Share on other sites More sharing options...
revraz Posted February 5, 2008 Share Posted February 5, 2008 Up to you, username would be easier, and then link then via a user id from table to table. Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-459019 Share on other sites More sharing options...
jassikundi Posted February 5, 2008 Author Share Posted February 5, 2008 Hi thanks for that also, having setup the primary key as the user name when filling out the form and processing it how would I enter the data into the new contracts table which records the persons user name that is logged in? Is there a basic php way of doing this or is it mysql :S haven't ever done this before so all help is appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/#findComment-459147 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.