On Sun, 2005-05-08 at 17:37 +0100, David Precious wrote: > On Sunday 08 May 2005 12:37, Matthew Macdonald-Wallace wrote: > > Hi all, > > > > Following on from my post about php checkboxes, this is what I'm trying > > to do: > > > > Recipe ingredients are added to the database along with the recipe book, > > recipe name and some other information. > > Would be useful to know how you're storing this in the DB.
SQL for the database is as follows (some data left in to demonstrate!) -- phpMyAdmin SQL Dump -- version 2.6.1-pl2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 08, 2005 at 06:14 PM -- Server version: 4.0.24 -- PHP Version: 4.3.10 -- -- Database: `recipies` -- -- -------------------------------------------------------- -- -- Table structure for table `books` -- CREATE TABLE `books` ( `bookId` int(5) NOT NULL auto_increment, `bookName` varchar(255) NOT NULL default '', `bookAuthor` varchar(255) NOT NULL default '', `bookPublisher` varchar(255) NOT NULL default '', `bookISBN` varchar(255) NOT NULL default '', PRIMARY KEY (`bookId`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; -- -- Dumping data for table `books` -- INSERT INTO `books` VALUES (1, 'The Really Useful Ultimate Student Cookbook', 'Silvana Franco', 'Murdoch Books', '1853918458'); -- -------------------------------------------------------- -- -- Table structure for table `ingredientType` -- CREATE TABLE `ingredientType` ( `ingredientTypeId` int(5) NOT NULL auto_increment, `ingredientTypeName` varchar(255) NOT NULL default '', PRIMARY KEY (`ingredientTypeId`) ) TYPE=MyISAM AUTO_INCREMENT=11 ; -- -- Dumping data for table `ingredientType` -- INSERT INTO `ingredientType` VALUES (1, 'Dairy'); INSERT INTO `ingredientType` VALUES (2, 'Fish'); INSERT INTO `ingredientType` VALUES (3, 'Fruit'); INSERT INTO `ingredientType` VALUES (4, 'Tins'); INSERT INTO `ingredientType` VALUES (5, 'Herbs'); INSERT INTO `ingredientType` VALUES (6, 'Vegetables'); INSERT INTO `ingredientType` VALUES (7, 'Meat'); INSERT INTO `ingredientType` VALUES (8, 'Packets'); INSERT INTO `ingredientType` VALUES (9, 'Pasta'); INSERT INTO `ingredientType` VALUES (10, 'Poultry'); -- -------------------------------------------------------- -- -- Table structure for table `ingredients` -- CREATE TABLE `ingredients` ( `ingredientId` int(5) NOT NULL auto_increment, `ingredientName` varchar(255) NOT NULL default '', `ingredientTypeId` int(5) NOT NULL default '0', `ingredientWeightUnitId` int(5) NOT NULL default '0', PRIMARY KEY (`ingredientId`) ) TYPE=MyISAM AUTO_INCREMENT=5 ; -- -- Dumping data for table `ingredients` -- INSERT INTO `ingredients` VALUES (1, 'Lemon', 3, 0); INSERT INTO `ingredients` VALUES (2, 'Chicken Breasts', 10, 0); INSERT INTO `ingredients` VALUES (3, 'Rice', 8, 0); INSERT INTO `ingredients` VALUES (4, 'Coconut Milk', 3, 0); -- -------------------------------------------------------- -- -- Table structure for table `recipieIngredients` -- CREATE TABLE `recipieIngredients` ( `recipieId` int(5) NOT NULL default '0', `IngredientId` int(5) NOT NULL default '0', `recipieIngredientWeight` int(10) NOT NULL default '0', `recipieIngredientWeightUnitId` int(5) NOT NULL default '0' ) TYPE=MyISAM; -- -- Dumping data for table `recipieIngredients` -- INSERT INTO `recipieIngredients` VALUES (1, 1, 1, 5); INSERT INTO `recipieIngredients` VALUES (1, 2, 500, 1); INSERT INTO `recipieIngredients` VALUES (1, 3, 500, 1); INSERT INTO `recipieIngredients` VALUES (2, 1, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 0, 0, 0); INSERT INTO `recipieIngredients` VALUES (2, 4, 400, 2); -- -------------------------------------------------------- -- -- Table structure for table `recipieType` -- CREATE TABLE `recipieType` ( `recipieTypeId` int(5) NOT NULL auto_increment, `recipieType` varchar(255) NOT NULL default '', PRIMARY KEY (`recipieTypeId`) ) TYPE=MyISAM AUTO_INCREMENT=5 ; -- -- Dumping data for table `recipieType` -- INSERT INTO `recipieType` VALUES (1, 'Vegetarian'); INSERT INTO `recipieType` VALUES (2, 'Vegan'); INSERT INTO `recipieType` VALUES (3, 'Coeliac'); INSERT INTO `recipieType` VALUES (4, 'Meat'); -- -------------------------------------------------------- -- -- Table structure for table `recipies` -- CREATE TABLE `recipies` ( `recipieId` int(5) NOT NULL auto_increment, `recipieBookId` int(5) NOT NULL default '0', `recipieBookPage` int(5) NOT NULL default '0', `recipieTypeId` int(5) NOT NULL default '0', `recipieName` varchar(255) NOT NULL default '', `recipieComment` varchar(255) NOT NULL default '', PRIMARY KEY (`recipieId`) ) TYPE=MyISAM AUTO_INCREMENT=3 ; -- -- Dumping data for table `recipies` -- INSERT INTO `recipies` VALUES (1, 1, 23, 0, 'Lemon Chicken Rice', 'A quick and easy dish'); INSERT INTO `recipies` VALUES (2, 1, 12, 0, 'Lemon Coconut', ''); -- -------------------------------------------------------- -- -- Table structure for table `weightUnits` -- CREATE TABLE `weightUnits` ( `weightUnitId` int(5) NOT NULL auto_increment, `weightUnitName` varchar(255) NOT NULL default '', PRIMARY KEY (`weightUnitId`) ) TYPE=MyISAM AUTO_INCREMENT=6 ; -- -- Dumping data for table `weightUnits` -- INSERT INTO `weightUnits` VALUES (1, 'g'); INSERT INTO `weightUnits` VALUES (2, 'ml'); INSERT INTO `weightUnits` VALUES (3, 'L'); INSERT INTO `weightUnits` VALUES (4, 'mg'); INSERT INTO `weightUnits` VALUES (5, 'single'); Hope this helps somewhat, I know I've spelt recipes wrong throughout, but that's just one of those things! :) Cheers, Matt -- -- Matthew Macdonald-Wallace [EMAIL PROTECTED] "Quis custodiet ipsos custodes?" ____ � 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.
