CS310 Assignment 3 Solution and Discussion
-
Assignment No. 03
Semester: Fall 2019
CS310: Open Source Web Application Development Total Marks: 20
Due Date: January 15, 2020
Topics Covered: Topics of Week 6 to 10General Instructions:
Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
The assignment is submitted after due date.
The submitted assignment does not open or file is corrupt.
Assignment is copied (partial or full) from any source (websites, forums, students, etc.)Note: You have to upload your assignment solution only in .doc or .docx format only. File submitted other than Microsoft Word format will get zero marks.
Objective:
The objective of this assignment is to provide hands on experience of:
• Installing and configuring MySQL
• Database and table creation
• Inserting data into database (tables)Tools to use:
-
XAMP / WAMP / Vertrigo server
For any query about the assignment, contact at [email protected]
Problem Statement:
Suppose you are working as a web developer in a financial institute. A task is given to you is take the data of sale and save into a table into a database.
Table Structure:Column Name Data Type Id Numeric Name Text Region Text ClientName Text Units Numeric UnitCost Decimal Date Date Sample Data:
ID Name Region ClientName Units UnitCost Date 1 Pencil East Jones 95 1.99 01/06/2018 2 Binder Central Kivell 50 19.99 1/23/2018 3 Pencil Central Jardine 36 4.99 02/09/2018 4 Pen Central Gill 27 19.99 2/26/2018 5 Pencil West Sorvino 56 2.99 3/15/2018 6 Binder East Jones 60 4.99 04/01/2018 7 Pencil Central Andrews 75 1.99 4/18/2018 8 Pencil Central Jardine 90 4.99 05/05/2018 9 Pencil West Thompson 32 1.99 5/22/2018 10 Binder East Jones 60 8.99 06/08/2018 Solution Instructions:
To solve this assignment, you need to perform following steps with the help of PHP code.
• Connect to MySQL server.
• Create a database, the name of database should be your VU-ID.
• Create table “Sales” into database. Structure of table is given above.
• Insert sample data into “Sales” table. Sample data is given above.
• Take screen shot of data base from MySQL and paste into solution file.What you have to submit?
You have to copy/paste following into your solution file then upload solution file from your LMS account.
• PHP code which will create database, table and save sample database into table.
• Screen shot of “Sales” table from MySql using phpMyAdmin tool.Best of Luck!
-
-
-
Solution Idea!
php file
CS301.php<?php $host = "localhost"; $user = "root"; $password = ""; $dbname = "bc12345"; // Create connection $conn = mysqli_connect($host, $user, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "INSERT INTO `sales` (`ID`, `Name`, `Region`, `Client_Name`, `Unit`, `Unit_Cost`, `Date`) VALUES ('5', 'boll point', 'south', 'Jhon', '230', '120.99', '2020-01-12')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } mysqli_close($conn); ?> <!DOCTYPE html> <html> <head> <title>CS310 Assignment</title> </head> <body> </body> </html>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login






