multiple tables

wxdqz

New Member
Let me start out by saying I'm a newbie and I'm finding PHP confusing and to be honest I haven't really found that many tutorials around that help,plenty of scripts,but not many complete walk through tutorials.

I'm running win98,PHP4,Apache,and MySQL.

I need some constructive criticism on my table design as I have never done this before and it is for a relational database (I believe thats correct).Anyway it's a project to get myself started and I'm hoping the forum will help me along the way.It is based on bricks for sale that have been left over from projects (as I am a bricklayer).

Heres my table design :

MEMBERS TABLE
id Name Password Email Address Brickid
01 Joe hggfbm joe@ 4 street 1


BRICK TABLE
id BrickName ColorCode Quanity
01 Balmoral 0973 31


BUY/SELL TABLE
Memberid Brickid Buy Sell Quantity Holding
01 01 0.05 0.09 25 06

I dont see any way of cross referencing beyond what I have but if a member buys 10 bricks I have to be able to :

1. Check to make sure he has the funds first.If he has an offer to buy I need to be able to check that there is still enough Funds left to cover another purchase (I'll need another column for "FUNDS" in the MEMBER TABLE).

2. Tranfer Funds from 01 to 02 and transfer bricks from 02 to 01.

3. If 01 only buys 10 out of 25 bricks I need to be able to adjust the quantity of bricks still for sale.

4. I need to check through the color code and brick name columns to see if anyone else has the same bricks for sale e.g 2 people selling 25 bricks each and one person wanting to by 40.I believe these would be grouped in the Buy/Sell table anyway

I'm guessing that once I get into this more it will become less complicated but I believe I'm correct in my thinking in that it all begins with the correct table structure.

In the brick table the (in BrickName column) Balmoral would tend to come up repeatedly with different color codes,would I need another table : BrickName ??

Thanx to all in advance,even if you only read my post.
 
Back
Top