Re: Ideas?? (OT- MySQL)

From: Date: Thu, 25 Jan 2001 07:17:37 +0000
Subject: Re: Ideas?? (OT- MySQL)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36576@lists.php.net to get a copy of this message
<Website4S@aol.com> wrote ... > I am creating a web site which allows users to post projects and then > others to place bids. I am setting up two tables in MySQL 'Projects' > & 'Bids' my problem is how best to cross reference. What I was > thinking of doing is creating a number of fields in the Projects table... > > and then inserting the BidID from the bids table into Bid1, and if > that is already used then it will go into Bid2. But how many Bid# > shall I create?? I`m sure there must be a faster method than this, > anyone have any suggestions?? This is a standard question where you have two tables that need to be linked in a many-to-many relationship. The answer is that you need a third table, called for example ProjectBids. It has two columns, one for Bid ID and one for Project ID. Each row links one bid to one project. You can enter as many rows as you like, so each bid can be linked to one or more projects, and each project can be linked to one or more bids. But are you sure you have a many-to-many relationship? It sounds like each bid might be associated with just one project. In that case you could just have a column in the Bid table that contains the Project ID.

« previous php.general (#36576) next »