PHP Recipe Book
July 8th, 2007A buddy of mine has been on a quest for the best web based recipe/cookbook. He finally decided on PHPRecipeBook, so I decided to take a look at it. I am in the process of adding many features to daveline.com, and I thought family recipes would be a great addition.
I liked many features of PHPRecipeBook including the following.
- Easily Add Recipes
- Add photos of dish
- Recipe Scaling to change the serving sizes
- Ability to create monthly meal plans
- Ability to create shopping lists
- Estimate Meal Costs
- Much More
I liked what I saw, so I download PHPRecipeBook and tried to install it. As it turns out it wasn’t really designed for MySQL 5, so I had a bit of a problem running the install scripts. So I decided to find another PHP Cookbook. I did find another one I liked (RBook), but it also had its own issues, such as using a deprecated version of PEAR DB.
It didn’t have a many features, so I decided to try and get PHPRecipeBook working with MySQL 5.
The basic issues was that MySQL 5 does not allow the default value of ‘now()’ for dates. In the ‘recipedb.mysql’ file there are two places where this occurs.
CREATE TABLE recipe_mealplans (
mplan_date DATE NOT NULL DEFAULT ‘now()’,
and
CREATE TABLE recipe_reviews (
review_recipe INT NOT NULL REFERENCES recipe_recipes(recipe_id) ON DELETE CASCADE,
review_comments VARCHAR(255) NOT NULL,
review_date TIMESTAMP DEFAULT ‘now()’,
to fix this issue, I changed the sql code to look like this (I basically commented the original line of code, and removed the default of ‘now()’ )
CREATE TABLE recipe_mealplans (
#mplan_date DATE NOT NULL DEFAULT ‘now()’,
mplan_date DATE NOT NULL,
and
CREATE TABLE recipe_reviews (
review_recipe INT NOT NULL REFERENCES recipe_recipes(recipe_id) ON DELETE CASCADE,
review_comments VARCHAR(255) NOT NULL,
#review_date TIMESTAMP DEFAULT ‘now()’,
review_date TIMESTAMP,
Code to drop all tables if you receive an error if you have to try import scripts again.
drop table recipe_bases;
drop table recipe_courses;
drop table recipe_difficulty;
drop table recipe_ethnicity;
drop table recipe_favorites;
drop table recipe_ingredient_mapping;
drop table recipe_ingredients;
drop table recipe_list_ingredients;
drop table recipe_list_names;
drop table recipe_list_recipes;
drop table recipe_locations;
drop table recipe_meals;
drop table recipe_prep_time;
drop table recipe_recipes;
drop table recipe_related_recipes;
drop table recipe_settings;
drop table recipe_sources;
drop table recipe_stores;
drop table recipe_units;
drop table security_groups;
drop table security_members;
drop table security_users;
drop table recipe_mealplans;
drop table recipe_reviews;
drop table recipe_ratings;
drop table recipe_prices ;
drop table recipe_restaurants;
References