Create a MySQL Database called “CSC306Class”. Create three (3) tables in the database called “studentInf”, “IntructorInf”, and “LikedAndDisliked”. Each table should consist of five columns that are relatable to the table name. Insert at least five row of data in each table. The data can be any information as long as it is related to the table name. Upload the codes to complete the above for grading. Extra Credit: If you were able to download and setup an php server on computer. Try to create the database, tables, and rows. Then upload a screenshot and code for extra credits
This is for a PHP class
I'm using Ubuntu for setting up PHP apache and php-mysql
server.
Installed them by following commands:-
$> sudo apt install apache2
$> sudo apt install mysql-server
Then create root user on localhost with password 12345.
$> mysql -u root -p -h localhost
Then create a new user with host and password.
i have created 'demo' user with password '12345'.
$mysql> CREATE USER 'demo'@'localhost' IDENTIFIED BY '12345';
Then create database CSC306Class
$mysql> CREATE DATABASE CSC306Class;
Grant all privileges for 'demo' user for this database
$mysql> GRANT ALL PRIVILEGES ON CSC306Class.* TO 'demo'@'localhost';

PHP file for creating Tables.
<!DOCTYPE html>
<html>
<head>
<title>PHP Class</title>
</head>
<body>
<?php
$servername = "localhost";
$username = "demo";
$password = "12345";
$dbname = "CSC306Class";
// create connection
$conn = new mysqli($servername, $username, $password,
$dbname);
// check connection is created
if ($conn->connect_error) {
die("Connection failed: " .
$conn->connect_error);
}
// StudentInf table
$StudentInfTable = "CREATE TABLE StudentInf (
rollNo INT(4) PRIMARY KEY,
firstName VARCHAR(50) NOT NULL,
lastName VARCHAR(50) NOT NULL,
sex VARCHAR(10),
course VARCHAR(50)
)";
// InstructorInf table
$InstructorInfTable = "CREATE TABLE InstructorInf (
id INT(4) PRIMARY KEY,
firstName VARCHAR(50) NOT NULL,
lastName VARCHAR(50) NOT NULL,
title VARCHAR(50),
phoneNo VARCHAR(20)
)";
// LikedAndDislikedTable
$LikedAndDislikedTable = "CREATE TABLE LikedAndDisliked (
id INT(4) PRIMARY KEY,
liked INT(4),
disliked INT(4),
comment VARCHAR(50),
rating INT(5)
)";
// drop StudentInf table if already exists
if ($conn->query("DROP TABLE IF EXISTS StudentInf") === TRUE)
{
// create StudentInf table
if ($conn->query($StudentInfTable) === TRUE) {
echo "Table StudentInf created
successfully<br>";
} else {
echo "Error creating table: " .
$conn->error;
}
} else {
echo "Error dropping table: " .
$conn->error;
}
// drop InstructorInf table if already exists and create
new
if ($conn->query("DROP TABLE IF EXISTS InstructorInf") === TRUE)
{
if ($conn->query($InstructorInfTable) === TRUE) {
echo "Table InstructorInf created
successfully<br>";
} else {
echo "Error creating table: " .
$conn->error;
}
} else {
echo "Error dropping table: " .
$conn->error;
}
// drop LikedAndDisliked table if already exists and create
new
if ($conn->query("DROP TABLE IF EXISTS LikedAndDisliked") ===
TRUE) {
if ($conn->query($LikedAndDislikedTable) === TRUE) {
echo "Table LikedAndDisliked created
successfully<br>";
} else {
echo "Error creating table: " .
$conn->error;
}
} else {
echo "Error dropping table: " .
$conn->error;
}
// array of StudentInf table data
$studentData = array("INSERT INTO StudentInf VALUES (101, 'AAAAA',
'ZZZZZ', 'Male', 'PHP')",
"INSERT INTO StudentInf VALUES (102, 'BBBBB', 'YYYYY', 'Female',
'C++')",
"INSERT INTO StudentInf VALUES (103, 'CCCCC', 'XXXXX', 'Female',
'Java')",
"INSERT INTO StudentInf VALUES (104, 'DDDDD', 'WWWWW', 'Male',
'PHP')",
"INSERT INTO StudentInf VALUES (105, 'EEEEE', 'VVVVV', 'Male',
'C#')");
// array of InstructorInf table data
$instructorData = array("INSERT INTO InstructorInf VALUES (10,
'AAAAA', 'ZZZZZ', 'PHP Expert', '263463432425')",
"INSERT INTO InstructorInf VALUES (11, 'BBBBB', 'YYYYY', 'C++
Expert', '2622334234')",
"INSERT INTO InstructorInf VALUES (12, 'CCCCC', 'XXXXX', 'Java
Expert', '91824712784')",
"INSERT INTO InstructorInf VALUES (13, 'DDDDD', 'WWWWW', 'PHP
Expert', '32785783713')",
"INSERT INTO InstructorInf VALUES (14, 'EEEEE', 'VVVVV', 'C#
Experts', '783478471274')");
// array of LikedAndDisliked table data
$likedAndDislikedData = array("INSERT INTO LikedAndDisliked VALUES
(10, 0, 5, 'Good', 10)",
"INSERT INTO LikedAndDisliked VALUES (11, 3, 3, 'Best', 6)",
"INSERT INTO LikedAndDisliked VALUES (12, 9, 1, 'Average',
5)",
"INSERT INTO LikedAndDisliked VALUES (13, 4, 0, 'Worst', 4)",
"INSERT INTO LikedAndDisliked VALUES (14, 5, 2, 'Not so good',
8)");
// insert each student data into table
for ($i = 0; $i < 5; $i++) {
if ($conn->query($studentData[$i]) != TRUE) {
echo "Error: " . $studentData[$i] . "<br>"
. $conn->error;
}
}
// insert each instructor data into table
for ($i = 0; $i < 5; $i++) {
if ($conn->query($instructorData[$i]) != TRUE) {
echo "Error: " . $instructorData[$i] .
"<br>" . $conn->error;
}
}
// insert each likedAndDisliked data into table
for ($i = 0; $i < 5; $i++) {
if ($conn->query($likedAndDislikedData[$i]) != TRUE) {
echo "Error: " . $likedAndDislikedData[$i] .
"<br>" . $conn->error;
}
}
// display all tables data
$result = $conn->query("SELECT * FROM StudentInf");
if ($result->num_rows > 0) {
echo
"<br><b>StudentInf</b><br>";
while($row = $result->fetch_assoc()) {
echo "RollNo: " .
$row["rollNo"]. " FirstName: "
. $row["firstName"]. " LastName: "
. $row["lastName"]." Sex: "
. $row["sex"]. " Course: " .
$row["course"]."<br>";
}
} else {
echo "0 results";
}
$result = $conn->query("SELECT * FROM InstructorInf");
if ($result->num_rows > 0) {
echo
"<br><b>InstructorInf</b><br>";
while($row = $result->fetch_assoc()) {
echo "ID: " .
$row["id"]. " FirstName: "
. $row["firstName"]. " LastName: "
. $row["lastName"]." Title: "
. $row["title"]. " PhoneNo: " .
$row["phoneNo"]."<br>";
}
} else {
echo "0 results";
}
$result = $conn->query("SELECT * FROM LikedAndDisliked");
if ($result->num_rows > 0) {
echo
"<br><b>LikedAndDisliked</b><br>";
while($row = $result->fetch_assoc()) {
echo "ID: " .
$row["id"]. " Liked: "
. $row["liked"]. " Disliked: "
. $row["disliked"]." Comment: "
. $row["comment"]. " Rating: " .
$row["rating"]."<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>

Create a MySQL Database called “CSC306Class”. Create three (3) tables in the database called “studentInf”, “IntructorInf”,...
Create a database called COMPANY using those generated SQL scripts in MySQL database. Show the screenshot of your database and tables in MySQL. To manage your database, you can use the phpmyadmin tool or MySQL Workbench.
Using the MySQL Workbench create a new database using your design specifications Add at least 10 records to your tables. Note: Certain tables may not require 10 records and that is ok as long as your main tables have 10 or more Create MySQL statements that will retrieve all records or rows from the tables in your database Create 10 MySQL statements that will retrieve specified records or rows from one table in your database Create 10 MySQL statements that...
Hello, I'm working on inserting data into a table using MySQL and Python on my Windows OS laptop; and I am asked to modify the script so that it executes an insert query in one of my database tables. I am also asked to print the table before and after I execute this query in order to ensure the new information was inserted into the table. I'd like to INSERT INTO my EMPLOYEE table. The columns are employee_id, employee_password, order_id...
Create a new MySQL database called "players". Create a user for your database named "Jane". Jane is a new employee who, in your challenge, will create a new table called "phillies". This table will hold 1 record only. This record is a description of Jane's favorite sports team, the Philadelphia Phillies. She needs to input the following data for her favorite player, Cole Hamels: Be sure to consider which data types you should use for each data point that needs...
Using PHP and MYSQL create a form that: user Full name user Comment (as many lines as they want) allows the user to attach one image uploads the Full name, comment, and image to a database Displays the user's full name, comment and user image on the website by selecting them from the database. Include the server connection file as well any necessary codes to connect and maintain the database
Write code for mySQL 1) create a new one database ; to create your table 2) Every table should have a primary key 3) Table relationship has to be based on foreign key and shown within your physical table 4) Insert 5 data records in every table 9) Create a database view that return result set of all record and all columns within all 6 table
Create the script for a table in the clinic database you made called Medicine and include the following columns: MedicineID, MedicineName, MedicineForm, MedicineCost, MedicineDose. Make the columns the appropriate data type and include any primary key and identity requirements. Add five rows of data to the table, using appropriate values. Provide the script here.
MySQL 8 Create a PHP program that will read in each table of the database you created in Assignment 8 and display the values into a good looking table. When I run it, I'm having this error " Parse error: syntax error, unexpected '$dbName' (T_VARIABLE) in C:\xampp\htdocs\assignment9\includes\dbh.inc.php on line 6' Here is my index.php <?php include_once 'includes/dbh.inc.php'; ?> <!DOCTYPE html> <html> <head> <title></title> </head> <body> <?php $sql = "SELECT * FROM comic_book.books;"; $result = mysqli_query($conn, $sql);...
PHP : I need to make a table in database that holds three fields. A unique key, a name, and an email. then I have to make two PHP files. One of those files has a form with two fields that allow the user to enter their name and email. This file then enters that data into the database table and acknowledges the entry. The second PHP file does a query on that database and prints out a table with two...
Through the remaining assignments due in this course, you will be creating a simple database for tracking information about volunteers working and raising money for a community organization. This assignment requires that you create the initial table, called PERSON, to hold basic information about volunteers. You will be redefining the design and building the database in the upcoming unit assignments. 1.Use the mysqldump.exe command line tool to backup the data in your volunteer database. To access the mysqldump.exe tool, start...