Jump to content

Storing Data to Database Help


jassikundi

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/89583-storing-data-to-database-help/
Share on other sites

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

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.

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?  ???

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

;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.