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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.