Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi everybody,

I've been reading this forum from a long time but I signed up today coz I got a problem.

This could be very simple problem. I am a newbe and did not find the exact problem

discussed in the forum.

I downloaded the books scripts from Larry's site and try to follow the second site

on the book. I got the following error message while importing the sql.sql file via

phpmyadmin.

I amusing wamp server (all other sites are working just fine)

Php version: 5.3.4

Mysql version: 5.1.53

Apache: 2.2.17

 

Error

 

SQL query: Documentation

 

DELIMITER ; -- ----------------------------- -- Later in Chapter 8: -- -- ----------------------------- DELIMITER $$ CREATE PROCEDURE select_products(type VARCHAR(6), cat TINYINT) BEGIN IF type = 'coffee' THEN SELECT gc.description, gc.image, CONCAT("C", sc.id) AS sku, CONCAT_WS(" - ", s.size, sc.caf_decaf, sc.ground_whole, sc.price) AS name, sc.stock, sc.price, sales.price AS sale_price FROM specific_coffees AS sc INNER JOIN sizes AS s ON s.id=sc.size_id INNER JOIN general_coffees AS gc ON gc.id=sc.general_coffee_id LEFT OUTER JOIN sales ON (sales.product_id=sc.id AND sales.product_type='coffee' AND ((NOW() BETWEEN sales.start_date AND sales.end_date) OR (NOW() > sales.start_date AND sales.end_date IS NULL)) ) WHERE general_coffee_id=cat AND stock>0 ORDER by name; ELSEIF type = 'other' THEN SELECT ncc.description AS g_description, ncc.image AS g_image, CONCAT("O", ncp.id) AS sku, ncp.name, ncp.description, ncp.image, ncp.price, ncp.stock, sales.price AS sale_price FROM[...]

 

MySQL said: Documentation

#1304 - PROCEDURE select_products already exists

 

somebdy please helpexactly what to do.

Regards,

Bob

Link to post
Share on other sites

Hey Bob,

 

As I believe it says on the Web site, and in the SQL file itself, you should not import the entire file as is. This is in part because one stored procedure gets redefined at a later point in the book. My recommendation is to copy and paste the SQL commands as needed as you go through the material.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...