ASSIGNMENT 4 | BASIC CRUD PRAVIIN M | IS 667 | 71749 | ONLINE 1 Assignment 4 CREATE – READ Please do the following: a) Download the zip folder from the assignment on to your computer. b) Extract the contents of the folder and place all the contents into a directory (name of your choice) under htdocs of your XAMPP c) In your PHPMyAdmin create a new database (name of your choice – I have used UserManager). I have attached a .sql file. Import the file into the database you created. You should have a table named “user” in the database. Read step “e” for more information. d) Open db-settings.php and change the parameters of the following: $db_host = "localhost"; //Host address (most likely localhost) $db_name = "UserManager"; //Name of your Database $db_user = "root"; //Name of your database user $db_pass = "darthvader"; //Password for database user The $db_host = “localhost” will remain the same unless you already have hosted your DB on your neighbors’ computer (highly unlikely) The $db_name will be the name of the database you created at step C $db_user will be “root” unless you have changed it Password should be blank. If you created a password while setting up your MySQL. You will need to enter that password. Mine is “darthvader” NOTE: Username and Password can be for the user created for the database that you created during step C OR simply root with a password will also suffice. e) In your newly created database import the contents of userDemo.sql attached in the assignment OR open the userDemo.sql in PHPStorm OR text editor of your choice and copy paste the contents into a new query window and run the query. I recommend that you do not use a regular notepad because it might invert the single quotations in the queries messing the thing up further. This step should create a new table with name User. f) The above steps should be enough to run the code (localhost/ OR localhost:8080/ OR localhost:8888) PROBLEM: ASSIGNMENT 4 | BASIC CRUD PRAVIIN M | IS 667 | 71749 | ONLINE 2 Since we completed create and display records. You will be writing functions in functions.php for performing various tasks! Do the following: • Add a new hyperlink to table in index.php called “Movies and Shows I watch” • In functions.php write a new function called moviesandshows() [OR WHATEVER FUNCTIONNAME YOU WANT TO USE]– write necessary query inside the function a. That function should insert records i. Add the following fields (columns) in the table 1. MovieID (autoincrement) 2. MovieShowName 3. TimesWatched (number) 4. Rating (number?) 5. DateWatched (date) As you must have already guessed. You will need a new table with the necessary columns. SECTION – II • Add a new hyperlink to table in index.php called LIST 20 RECORDS • In functions.php write a new function called fetchRecords() [OR WHATEVER FUNCTIONNAME YOU WANT TO USE]– write necessary query inside the function - To display 20 records. • If you want to get creative, you may want to select 20 random records each time we go to the page. • Search any movie show by name ( I am sure you are going to have Game of Thrones in there. so might as well search that as too ) • Display Movies by rating • Display the movies you have watched more than once As always, get a screenshot of the Index.php (which will display the new menu item) and then the insert form, the database table and then place the functions in a text file or you can take screen shots of them as well. I need the code so you will have to send me the files. ASSIGNMENT 4 | BASIC CRUD PRAVIIN M | IS 667 | 71749 | ONLINE 3
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here