Question

In: Computer Science

Create a new SQL table in your phpMyAdmin account that collects the following fields (columns) -  (10...

Create a new SQL table in your phpMyAdmin account that collects the following fields (columns) -  

1) The name of a medicine, sanitizer, or tip/trick for protecting yourself against transmission or fight the disease - STRING

2) The amount of money the item costs - NUMBER

3) The UPC code of the item - NUMBER

4) Manufacturing country of the item - STRING

Connect to the SQL database with your HTML code, and make sure to show the results of ALL columns show! -

Create a form where the user can insert their items into the 4 columns mentioned above -

Build the HTML site with at least 5 pictures and a few paragraphs explaining your creativity (and how important it is to be safe this flu season!) - make sure to use proper APA guidelines for your in-text citations and a bibliography section! -

Solutions

Expert Solution

SQL Code :

CREATE TABLE table1 (
Medicine_name varchar(255),

Amount int,

  
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255)
);

Html code : //I have written basic html code for creating the from. Hope you can insert pictures and write relevant text.

<!DOCTYPE html>

<html>

<head>

<title>Form site</title>

</head>

<body>

<form method="post" action="connect.php">

Cure : <input type="text" name="Medicine"><br><br>

Cost : <input type="number " name="Cost"><br><br>

UPC  : <input type="number " name="UPC"><br><br>

Country : <input type="text" name="Country"><br><br>

<input type="submit" value="Submit">

</form>

</body>

</html>

Php code:

<?php

$cure = filter_input(INPUT_POST, 'cure');

$cost = filter_input(INPUT_POST, 'cost');

if (!empty($cure)){

if (!empty($cost)){

$host = "localhost";

$dbusername = "root";

$dbpassword = "";

$dbname = "my_db";

// Create connection

$conn = new mysqli ($host, $dbcure, $dbcost, $dbname);

if (mysqli_connect_error()){

die('Connect Error ('. mysqli_connect_errno() .') '

. mysqli_connect_error());

}

else{

$sql = "INSERT INTO account (cure, cost)

values ('$cure','$cost')";

if ($conn->query($sql)){

echo "New record is inserted sucessfully";

}

else{

echo "Error: ". $sql ."

". $conn->error;

}

$conn->close();

}

}

else{

echo "Values should not be empty";

die();

}

}

else{

echo "Values should not be empty";

die();

}

?>


Related Solutions

Using SQL create a new database called school_app. Create a student table with fields id (auto...
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2,...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns 2.Alter the tables to add the columns 3.Alter the tables to create the primary and foreign keys
Create a class named “Car” which has the following fields. The fields correspond to the columns...
Create a class named “Car” which has the following fields. The fields correspond to the columns in the text file except the last one. i. Vehicle_Name : String ii. Engine_Number : String iii. Vehicle_Price : double iv. Profit : double v. Total_Price : double (Total_Price = Vehicle_Price + Vehicle_Price* Profit/100) 2. Write a Java program to read the content of the text file. Each row has the attributes of one Car Object (except Total_Price). 3. After reading the instances of...
Write a SQL script to add another table to your database. Include these fields in your...
Write a SQL script to add another table to your database. Include these fields in your Product table: Field Name Description Data Type Sample Value ProductID Product ID integer 5 ProductName Product Name varchar(50) candle Description Product Description varchar(255) Bee’s wax candle picUrl Filename of the product’s picture varchar(50) candle.gif Price Product Price decimal 10.99           ProductID should be the Primary Key. It is an auto-increment field.           The Price field stores prices to 7 significant digits and to 2...
1. Write the statements to create a table named REQUIREMENTS. The table has the following columns:...
1. Write the statements to create a table named REQUIREMENTS. The table has the following columns: credits number (primary key) and degree name. 2. Write the statements to create a table named CANDIDATE with the following columns names. Pick the best column type: student_id, first name, last name, credits and graduation date. The credits column is a foreign key to the credits column in the REQUIREMENTS table. 3. Write the statement(s) to Insert 2 rows in your REQUIREMENTS table. Make...
SUBJECT: PROGRAMMING IN SQL 1. Create a view named vDepartmentInstructors that returns these columns: the DepartmentName...
SUBJECT: PROGRAMMING IN SQL 1. Create a view named vDepartmentInstructors that returns these columns: the DepartmentName column from the Departments table the LastName, FirstName, Status, and AnnualSalary columns from the Instructors table. 2. Write a SELECT statement that returns all the columns from the vDepartmentInstructors view that you created in question 1. Return one row for each fulltime instructor in the English department. 3. Write an UPDATE statement that updates the vDepartmentInstructors view you created in question 1 so it...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
Use a single SQL statement to create a relational table and to load into the table...
Use a single SQL statement to create a relational table and to load into the table department name, subject code, year of running and session of running that offered by the departments. Note that a running subject offered by a department means a lecturer of the department has been assigned to teach the subject. Next, enforce the appropriate consistency constraints on the new table.    When ready use SELECT statement to list the contents of the relational table created and...
Create a table with name “S_YOURStudentID” with the following fields with required constraints. Screenshots are to...
Create a table with name “S_YOURStudentID” with the following fields with required constraints. Screenshots are to be attached.                                                                                               For example, if your botho student id is 1212121, your table name should be “S_1212121”.                                   Student id Student Name Age Gender City Course name Module Name Internal mark 1 Internal mark 2 Internal mark 3 Total internal mark Insert minimum 10 records/rows to the table. Input the data based on Question 5. Screenshots are to be attached.                                                                                                                              Create two users...
Using Triggers (5 pts.) Execute the following SQL to create the customer_audit table in the premier...
Using Triggers (5 pts.) Execute the following SQL to create the customer_audit table in the premier schema. CREATE TABLE IF NOT EXISTS customer_audit ( customer_num CHAR(3) NOT NULL,   customer_name VARCHAR(35) NOT NULL, street VARCHAR(15), city VARCHAR(15), state CHAR(2), zip CHAR(5), credit_limit DECIMAL(8,2), date_changed DATETIME NOT NULL, changed_by VARCHAR(45) NOT NULL); Notice that the audit table does not have a primary key defined. Explain why this might be acceptable. Based on the current attributes in the customer_audit table, suggest a possible...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT