dbdavis55 Posted April 23, 2014 Share Posted April 23, 2014 Here is my assignment: I just need help with creating this application. Please can you help me. The goal of this program is to create a CRUD application for the MySQL database table recipe with this definition: id int auto_increment primary key not null,title varchar(255) unique not null,description text not null The title field is a simple one-line designation and the description represents the instructions in HTML format. The SQL type text, used for the recipe's description, is meant to be used for general, multi-line text content. Program SetupWithin your roadrunner public_html directory, the following directory has already been created.prog4Log in to your account via a secure-shell client.Install the database initialization file include/db.php. The easiest thing to do is to copy/paste it from things, either through Dreamweaver, or from the shell:$ cd public_html $ cp things/include/db.php prog4/include/ Lastly you can create it from scratch as: include/db.php <?phprequire_once "rb.php"; $db = "dd750782";$user = "dd750782";$pass = "dd750782";$url = "mysql:host=localhost;dbname=$db"; R::setup( $url, $user, $pass ); R::freeze( true );select Run the database setup script:$ cd ~/public_html/prog4 $ php setup/make_recipes.php Edit validate.php and modify the password to a value you want. As you develop this application, run the make_recipes.php script whenever you want to reset the database. Activate the program URL:http://roadrunner.cs.wcupa.edu/~dd750782/prog4/ There are three scripts to complete for the assignment which are described below:index.phpadd.phpmodify.phpSome general points are:Forms whose actions add, modify, or delete records must use the POST method; modify is likely to fail if you use the GET method! Avoid notices without weakening the error_reporting status. All reentrant activations should have sticky form fields. Other than choice of colors, make your the presentations be as indicated by the screen shots below. Visual effects should be made, whenever possible, using style rules. In particular, use width and height style properties to control the sizes of textfields and textareas. The intention of this program is that it be "responsive" in the sense that fields can scale down as the browser width changes. Make good use of percentages for widths. Select a recipe: index.phpThe home link (when logged in) should present a selection list of recipe titles like this (with the drop-down is activated):On pressing the Show It button, the selected recipe is displayed. The description presentation should be visually distinguished. The Modify/Removebutton should appear, as indicated, only when a selection is made. Add a recipe: add.phpThe subfolderrecipe_samplescontains one recipe, Easy_Meatloaf.txt, that you can use for testing. Download it (e.g., WinSCP) to your client, open it (e.g. NotePad++) and add it with a variety of titles. TextareaThe add form indicated below consists of a textfield for the title and a textarea for the description. The textarea code within the form should look something like this:<textarea name="description" spellcheck="off"><?php echo ... ?></textarea>Points to note about this usage are:there should be no superfluous white space characters (newlines or otherwise) between the start and end textarea tags the spellcheck="off" attribute setting is useful to avoid having the HTML-based content flagged (I know of no way to achieve this effect through style properties) In modern browsers textarea elements are resizable, meaning that you may want to set the max-width and/or min/max-height style properties. UsageChoosing the Add menu link activates add.php which initially presents an empty form for adding a new recipe:Pressing the Add button makes a reentrant call to add.php attempting to add a new recipe. If successful, redirect to the home page with the newly created recipe selected and shown. Two possible entry errors have to do with the title:It must have at least 3 characters (when trimmed). It must be unique among recipe titles. The entry fields must be sticky to support error handling. If either of these errors occur, display an error response. For example, suppose we start typing "my favorite recipe" like this but press the Add button submit prematurely:We continue and "complete" our recipe, setting:title: my favorite recipedescription: I don't have to write it nowSubmit it, redirecting to show the result: Modify/Remove a recipe: modify.phpPressing the Modify/Remove button when a recipe is presented activates modify.php. We want both the title and the description to be modifiable. The contents are loaded into form similar to that used in add: RemovePressing the Remove button effects a removal of the recipe. Activation of removal should be protected by user confirmation as done in the thingsapplication. If confirmed, delete the recipe and redirect to the home page (with nothing selected). ModifyPressing the Modify button should effect changes to the fields. The behavior is basically the same as for add; in particular, although they are less likely to occur in practice, these could happen, causing an error:the user could attempt to reduce the title length to under 3 characters the user could attempt to change the title to that of another recipe Upon success, we redirect to show the result as in adding. For example, suppose I decide to "simplify" the above selected recipe by making these changes before pressing the Modify button:After pressing the Modify button, I get this: Quote Link to comment https://forums.phpfreaks.com/topic/287955-creating-a-crud-application-for-the-mysql-database/ Share on other sites More sharing options...
QuickOldCar Posted April 23, 2014 Share Posted April 23, 2014 Help in what way? Homework is meant so you actually learn something from it. If have a particular question about how to do something am sure people will help. Quote Link to comment https://forums.phpfreaks.com/topic/287955-creating-a-crud-application-for-the-mysql-database/#findComment-1477022 Share on other sites More sharing options...
dbdavis55 Posted April 23, 2014 Author Share Posted April 23, 2014 I'm trying to include the menu items to a drop down list so the user can select the menu item and display the recipe. Quote Link to comment https://forums.phpfreaks.com/topic/287955-creating-a-crud-application-for-the-mysql-database/#findComment-1477023 Share on other sites More sharing options...
trq Posted April 23, 2014 Share Posted April 23, 2014 And you are having problems where specifically? Quote Link to comment https://forums.phpfreaks.com/topic/287955-creating-a-crud-application-for-the-mysql-database/#findComment-1477024 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.