Jump to content

[SOLVED] DATE field help!


Cassie_au

Recommended Posts

hey guys!!

 

found this forum while looking for help :s

 

im currently doing an assignment for school with php and mysql.

 

i need to setup some tables for items in a shop, however i need to include foreign keys.

could anybody give me any ideas as to which table fields would link to what? (as an example)

 

thanks in advanced guys! :D

Link to comment
Share on other sites

hey mezise!

 

thanks for the help!  :D that actually answered a lot of my questions!

 

however ive come across another prob:

 

im making a table for members when they sign up. i have a field for Date of Birth, what field type should it be? DATE?

 

thanks again guys! ;D

Link to comment
Share on other sites

Hey thanks again mezise! ;D

 

sorry my questions must sound so dumb to yous.

 

i have to make an 'orders' table also.

besides: id, date, customer_id, and amount fields, shouldn't there also be a field for the product(s) theyre ordering? and what if there's more than one product?

 

thanks in advanced!  :D

Link to comment
Share on other sites

Add table PRODUCTS(id, name)

and table ORDERS_PRODUCTS(order_id, product_id).

 

hi!

 

should product_id be a foreign key with PRODUCTS.id?

and what would happen if there is more than one item in the order?

 

thanks mezise!  ;D

Link to comment
Share on other sites

should product_id be a foreign key with PRODUCTS.id?

Yes, correct, as the name suggests (I thought it was obvious).

 

and what would happen if there is more than one item in the order?

ORDERS_PRODUCTS will be filled with first record with appropriate order_id and product_id and every next record with the same order_id and succeeding product_id.

 

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.