How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask TheDoctor Your Own Question

TheDoctor
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1461
Experience:  M.S. in Internet Information Systems
59032869
Type Your Homework Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

For "The Doctor" Extend the recipe application (link to

Resolved Question:

For "The Doctor"

Extend the recipe application (link to files below) to allow users to rate and comment on recipes. Your application should:
Allow each user to post one rating (1–5 scale), with a short comment, for each recipe
Calculate number of ratings for each recipe
Calculate the average rating for each recipe
Display all ratings and comments for a particular recipe
Display the number of ratings and the average rating for each recipe in the recipe directory
Before you write any PHP code, create a table to store the comments and ratings. Based on the requirements above, the table needs fields that identify the user and the recipe, their rating and comment. You should not store the number or average rating for a recipe, but rather calculate these values when necessary. Consider including the date of submission and possibly other fields. Although a user can have only one rating per recipe, each user can rate many recipes, and each recipe may have many ratings. In 1–2 paragraphs, explain how these facts influenced your choice of primary key for this table.

Next, update the PHP application by writing and testing code to:
Allow a logged-in user to rate and comment on a recipe
Allow a user to display the comments on a recipe
Display the number and average rating on the recipe pages
You may find it helpful to structure your code by using PHP functions.

Discuss the design choices you faced and explain the decisions you made (not elaborate). Be sure to address how you ensure that a user cannot rate the same recipe twice and how you handle the average for recipes with no ratings.

Files are located at http://wikisend.com/download/454980/recipes.zip

Thanks!
Submitted: 1 year ago.
Category: Homework
Expert:  TheDoctor replied 1 year ago.
Hello again! Thank you for requesting me.

It would be my pleasure to assist you with this. However, such a request is fundamentally high-detail. Any question that requires writing entire scripts of code and creating new database tables is extremely high-detail. A low detail question would be a short answer requiring perhaps 15 - 30 minutes to write up a response. Completing this request will take up to 4 hours of work and the current question value does not justify dedicating that much time.

I will send an under-priced report. You will receive an email with the suggested question value and a link to update the question value.

Thank you
Customer: replied 1 year ago.

no problem

Expert:  TheDoctor replied 1 year ago.
Thank you.

I will contact you once this is complete.
Expert:  TheDoctor replied 1 year ago.
Hello again!

You can download the completed project here:

http://wikisend.com/download/168242/allDone.zip

Inside of newTable.txt you will find the sql for the new table. You must run this sql on your database before any of this will work.

The ratings table represents a many to many relationship between recipes and users. Therefore, the ratings table acts as a join table between the users and the recipes with the user_id and the recipe_id acting as identifying foreign keys between the two tables. These two identifying relationships form a compound primary key. A user and a recipe together identifies a rating (hence an "identifying relationship). This forms a compound primary key on the rating table (user_id, recipe_id).

If no ratings have been submitted for a recipe, no rating is supplied. If there have been ratings, then I simply use the AVG and COUNT aggregate functions in MySQL to get the average rating and number of ratings.

If a user is signed in, they can rate a recipe that they did not enter. A user cannot rate their own recipe. Once a rating has been entered, the user will see it whenever they view the recipe. If the user wishes, he can change his previous rating. However, it is impossible to enter more than one rating per recipe. This is accomplished with the ON DUPLICATE KEY UPDATE functionality in MySQL.

I think you will find that this meets all of the requirements and does so quite nicely. I believe your instructor will enjoy the stars on the view_recipe page.

Let me know if you have any questions. I'm here to help.

Please remember to rate my answer. Thank you so much!
Customer: replied 1 year ago.

Sorry have not had a chance to test yet, but will do so later today and make sure I rate it, thanks for everything.

Expert:  TheDoctor replied 1 year ago.
You are very welcome. I look forward to hearing back from you.
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1461
Experience: M.S. in Internet Information Systems
TheDoctor and 12 other Homework Specialists are ready to help you
Customer: replied 1 year ago.
I have downloaded and tried the files, created the table, but I do not see anything about ratings anywhere on the index page, and when I try to load the file view_ratings I get the error:

Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'view_ratings.tpl'' in C:\xampp\htdocs\Smarty\libs\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 C:\xampp\htdocs\Smarty\libs\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('view_ratings.tp...', NULL, NULL, NULL, true) #1 C:\xampp\htdocs\Unit5\view_ratings.php(53): Smarty_Internal_TemplateBase->display('view_ratings.tp...') #2 {main} thrown in C:\xampp\htdocs\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 127
Expert:  TheDoctor replied 1 year ago.
I assure you that it all works without issue. It is saying that it cannot find the file view_ratings.tpl

You can see that the view_ratings.tpl is in the files that I sent you.

Do you have time to do a quick remote session? If so, please go to join.me

Once there, select the big orange button to share your screen. You may be asked to install the software. Select yes to everything and allow access to everything. Once it is running, there will be a small dashboard at the top of your screen. Select the URL/address in that dashboard and copy it. Then paste it into this thread so that I can join you.

Thank you
Customer: replied 1 year ago.
https://join.me/593-853-492
Expert:  TheDoctor replied 1 year ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Last | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX
 
 
 

Meet The Experts:

 
 
 
  • Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4520
    More than 5000 online tutoring sessions.
< Last | Next >
  • http://ww2.justanswer.com/uploads/BU/BusinessTutor/2012-2-2_115741_Kouki2.64x64.jpg Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4520
    More than 5000 online tutoring sessions.
  • http://ww2.justanswer.com/uploads/LI/lindaus/2012-6-10_04811_IMG20120609164157.64x64.jpg Linda_us's Avatar

    Linda_us

    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    3121
    Post Graduate Diploma in Management (MBA)
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Engineer

    Satisfied Customers:

    3035
    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • http://ww2.justanswer.com/uploads/lanis/2009-4-1_233717_phput9xef_c1pm.jpg Lani S.'s Avatar

    Lani S.

    Tutor

    Satisfied Customers:

    2457
    Registered Nurse, Internet Researcher, Private Tutor
  • http://ww2.justanswer.com/uploads/chooser77/2009-08-18_162025_Chris.jpg Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    2341
    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • http://ww2.justanswer.com/uploads/JawaadAhmed/2009-6-27_12137_SIs_SHadi.jpg F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    1975
    Experience with chartered accountancy
  • http://ww2.justanswer.com/uploads/JK/jkcpa/2011-1-16_182614_jkcpa.64x64.jpg Bizhelp's Avatar

    Bizhelp

    CPA

    Satisfied Customers:

    1873
    Bachelors Degree and CPA with Accounting work experience