You couldn't specify the review_id in the products table... that would only allow you to add 1 review per product (but many products could have the same review... relationship is backwards)
Drop the review_id from products and put products_id in the review table... this way one product can have many reviews :) Also into the products table I would add [at least] a `name` field for the product... purely for readability HTH Dan ----------------------------------------------------- Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -----Original Message----- From: Matthew Macdonald-Wallace [mailto:[EMAIL PROTECTED] Sent: 24 March 2006 13:18 To: [email protected] Subject: Re: [wdvltalk] Potential website Quoting Portman <[EMAIL PROTECTED]>: > Hi all, > > I am considering working on a website for someone. This person wants > a button next to each product where people can read and/or post > reviews about the product. How would that be done? A bulletin > board/message board type thing or is that not professional enough? I > did look into software for my boss to put a message forum on her > website - we ended up not doing it - but that is what I am thinking > would work. Any opinions/feedback would be appreciated. I'm assuming this is database-driven? If so, why not add two tables to your database: TABLE 1: link_product_review review_id int(10) Stores the review Id product_id int(10) Stores the product Id TABLE 2: product_reviews review_id int(10) The review Id (probably auto-increment!) review_user_id int(10) Only needed if you want users to log in (requires a table for users) review_text longtext the text of the review review_rating int(2) gives the option to add a star rating etc to the product. the SQL would look something like: CREATE TABLE link_product_review ( review_id int(10) NOT NULL, product_id int(10) NOT NULL ); CREATE TABLE product_reviews( review_id int(10) auto_increment NOT NULL Primary Key, review_user_id int(10) NOT NULL, review_text longtext NOT NULL, review_rating int(2) NOT NULL ); You'd need to write the code to link everything together and insert the right values into each field and then retrieve the data again, but this would probably give you a good start! :) Hope this helps, Matt -- Matthew Macdonald-Wallace [EMAIL PROTECTED] "Sed quis custodiet ipsos custodies?" ____ . The WDVL Discussion List from WDVL.COM . ____ To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or use the web interface http://e-newsletters.internet.com/discussionlists.html/ Send Your Posts To: [email protected] To change subscription settings, add a password or view the web interface: http://intm-dl.sparklist.com/read/?forum=wdvltalk ________________ http://www.wdvl.com _______________________ You are currently subscribed to wdvltalk as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] To unsubscribe via postal mail, please contact us at: Jupitermedia Corp. Attn: Discussion List Management 475 Park Avenue South New York, NY 10016 Please include the email address which you have been contacted with. ____ The WDVL Discussion List from WDVL.COM ____ To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or use the web interface http://e-newsletters.internet.com/discussionlists.html/ Send Your Posts To: [email protected] To change subscription settings, add a password or view the web interface: http://intm-dl.sparklist.com/read/?forum=wdvltalk ________________ http://www.wdvl.com _______________________ You are currently subscribed to wdvltalk as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] To unsubscribe via postal mail, please contact us at: Jupitermedia Corp. Attn: Discussion List Management 475 Park Avenue South New York, NY 10016 Please include the email address which you have been contacted with.
