Help designing database!

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri Jun 08, 2012 3:32 pm

Help designing database!

Postby thetylercox » Fri Jun 08, 2012 3:35 pm

Help designing database!

The objective: Design a database for a local store in town to keep up with customers and their purchases.Not an online store!

The issue i'm having: How to handle the issue of repeat customers. So I have the fields they want to keep up with but on the return trip I don't want to delete the old info instead
I want to add to it. So when the record is pulled for this person it will show all there past purchases but only on one record. I had the idea of making another database for purchases and using unique keys I would query the purchased database! Enough with the rambling. I'm just open for ideas I am a bit of a nob when it comes to the designing and would kindly like some advice links something to point me in the right direction!

Thanks in advance
Tyler Cox

New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jun 10, 2012 10:45 pm

Re: Help designing database!

Postby jas891 » Sun Jun 10, 2012 11:23 pm

Hey there friend,

It's 3AM...but let me see if I can help you at all.

I think you are on the right track when you say a new database. It sounds like you need 2 tables...

Table #1 Customer Table containing:
customer name
customer phone number

Table #2 Order Table containing:
id_of_customer //referring to the customer on the customer table
order //you need to figure out the data here

You could even have a third table with info about each item in the store, and then an order could be a comma seperated list of items purchased...that would give the most complete data....but would require someone to sit down and add each type of thing in the store to the inventory

When you have the 2 tables and you want to get all orders for a certain customer you will be searching your mysql table WHERE id_of_customer= whatever their id is.

Hope this helps.

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 3 guests