Question: Assignment: Backend Development using MySQL - Apache - PHP Open and read the PHP file indexForDMLPractice . php using Notepad + + . This file
Assignment: Backend Development using MySQLApachePHP
Open and read the PHP file indexForDMLPracticephp using Notepad This file shows you how to connect to the database universitydb you created in previous homework. In addition, this file shows you how can you manipulate data in your database using PHP This file is an example of backend of database application.
Run and practice the PHP file indexForDMLPracticephp How to run a PHP file? Create a folder named MCIS in htdocs folder inside your xampp folder ie C:xampphtdocs MCIS Put the PHP file indexForDMLPracticephp into MCIS folder you created, ie C:xampphtdocsMCIS indexForDMLPractice.php Now, in your xampp control panel, start both Apache and MySQL Finally, in your web browser eg Google Chrome put localhostmcisindexForDMLPracticephp and press Enter. You should be able to see the output.
Following the codes in this file indexForDMLPracticephp add codes to perform the followings:
o Insert following data in the department table:
EnglishJennings
JournalismMorrill
o Insert following data in the Student table
davidphysics
o Increase the budget of English department by percent
o Change the building of Journalism department to Jennings.
o Print all data of student table
o Print the building of English department
What to submit: Create a report by putting snapshots showing your indexForDMLPractice.php is running successfully that is output screens in web browser for each SQL command in php file Submit the report and revised indexForDMLPractice.php which includes the codes you added.
connecterror
dieConnection failed: $connconnecterror;
else
echo "Successfully connected";
perform some data manipulation
insert a row in department table
$sql "insert into department values Physics 'Business', ;
if $connquery$sql TRUE
echo ; new line
echo "Insertion successful";
else
echo ; new line
echo "Error accessing database: $connerror;
Practice insert a new department LawMorril
Practice insert a row in student table
Test update: increase the budget of Physics department by percent
$sql "update department set budget budget where deptname 'Physics'";
if $connquery$sql TRUE
echo ; new line
echo "Update successful";
else
echo ; new line
echo "Error accessing database: $connerror;
Select command
$sql "SELECT FROM department";
$result $connquery$sql;
number of rows
echo "Total records: $resultnumrows";
display the records
if $resultnumrows
output data of each row
while$row $resultfetchassoc
echo "dept name: $rowdeptname" building: $rowbuilding $rowbudget;
else
echo results";
Test show the budget of CSC department
$sql "select budget from department where deptname 'biology'";
$result $connquery$sql;
echo "Total records: $resultnumrows";
$values $resultfetchassoc;
echo $valuesbudget;
terminate connection
$connclose;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
