PHP Homework Help | Practice Sample Set
- realcode4you
- Sep 23, 2021
- 5 min read

Requirement Details
Let there be database tables.
Rely on XAMPP and create the database table locally. You need to create a database called “assignment8” programmatically. Please submit the “create database” and “create table” sql commands, either through your init.php or if done separately, please submit it through a .sql file. In case you have a .sql file, please make sure that you are calling it from your .php file. I will need only to run your index.php and it should run the init.php which, if required, would run the .sql file.
Now that you have the details on how to connect to the database, you need to create a table that replicate the input.csv structure from last assignment; i.e. every column in that table needs to be translated into a column in the database.
Within your program, you need to open the input.csv file, read its content and every row in this csv table needs to be populated inside the database table you have created.
So, in summary, here is what you need to do:
Create a database called “assignment8”
Create a table named “Items”
Within this table, create the following columns
Structure for Items Table
Name Type Length/Values Default Attributes
ID INT 6 NONE Unsigned, auto_increment, primary key
Name VARCHAR 40 NONE
Type VARCHAR 40 NONE
Make VARCHAR 40 NONE
Model VARCHAR 40 NONE
3
Brand
VARCHAR
40
NONE
Description
VARCHAR
60
NONE
- Read the content of “input.csv” file and populate with it the rows of “items” table
- You need to create these columns from within a php page and for this reason, you need to create a file called init.php and use the examples in the slides or any other resource provided, to create the columns
o You run this file once only, since the database management system (DBMS) will create them once and they will be there for you anytime you access them
o Within your init.php, you need to insert the rows for each entry you have created in input.csv
- So, in summary, init.php will create the database, connect to it, create the table with the columns list provided above and populate this table with records read from the content of the file “input.csv”.
- You can use the default template provided for “input.csv” or even better, update this content with what you have been building through the whole course in term of services or products.
o One thing to pay attention to is that you do not need to insert the “item #” value from input.csv but you need to rely on the DBMS to auto-generate this field for you
- Now that we got the table populated, you need to go back to index.php and change your php code to read input from the database by querying it using a select statement
- The select statement needs to query the table created using the filtering input the user enters
o Select records from the table we are working with, where the name of the item is similar to <value entered by the user>
Dataset You can download form here
Hint and reference code
<!DOCTYPE html>
<html lang="en">
<?php include ('init.php') ; ?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<form action="index.php" method="post" enctype="multipart/form-data">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body onload="pageLoadingTime()">
<?php
class Item {
public $itemNumber;
public $name;
public $type;
public $make;
public $model;
public $brand;
public $description;
function __construct($itemNumber, $name, $type, $make, $model, $brand, $description){
$this->itemNumber = $itemNumber;
$this->name = $name;
$this->type = $type;
$this->make = $make;
$this->model = $model;
$this->brand = $brand;
$this->description = $description;
}
function display(){
return "Item Number : ".$this->itemNumber."<br>Item Name : ".$this->name."<br>Item Type : ".$this->type."<br>Make : ".$this->make."<br>Model : ".$this->model."<br>Brand : ".$this->brand."<br>Description: ".$this->description."<br>";
}
}
$inFile = fopen("input.csv","r") or die("File cannot be opened!!");
$line = " ";
$line_number = 1;
$content_of_line;
$items;
$i=0;
while(!feof($inFile)){
$line = fgets($inFile);
if (empty($line)) {
continue;
}
$words = explode(",",$line);
if (!is_numeric($words[0])) {
continue;
$stmt = $conn->prepare("INSERT INTO items (name, type, brand, model, make, description) values (?,?,?,?,?,?);");
$stmt->bind_param("ssssss", $words[1],$words[2],$words[3],$words[4],$words[5],$words[6])
$stmt->execute();
}
fclose($inFile);
?>
<header>
<div class="navbar">
<a class="active" href="#"><i class="fa fa-fw fa-home"></i> Home</a>
<div class="dropdown">
<button class="dropbtn">Products
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href="currency.php">Currency Exchange</a>
<a href="">Service 2</a>
</div>
</div>
<div class="dropdown">
<button onclick="location.href='contact.html'" class="dropbtn">Contact Us
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href=""><img class="countryFlag" src="img/france.png" alt="france">Contactez-nous</a>
<a href=""><img class="countryFlag" src="img/ukraine.png" alt="ukraine">Зв'затися з нами</a>
</div>
</div>
<a href="aboutme.html">About</a>
</div>
</header>
<div class="container">
<p class="pageLoading"></p>
<p class="bookHeader">PLASTIC SURGERY PROCEDURES</p>
<div class="about_product">
<h2>
Find most needed plastic surgery procedures.
</h2>
</div>
<p class="searchText">SEARCH FOR A PROCEDURE</p>
<div class="procedureSearch">
<input type="text" id="searchInput" onkeyup='search(<?php echo json_encode($items) ?>)' placeholder="Search for procedure..">
</div>
<ul id="myUL">
<li style="display: none;"><a href="#">A Journey to the Center of the Earth</a></li>
<li style="display: none;"><a href="#">The War of the Worlds</a></li>
<li style="display: none;"><a href="#">Brave New World</a></li>
<li style="display: none;"><a href="#">When Worlds Collide</a></li>
<li style="display: none;"><a href="#">Odd John</a></li>
<li style="display: none;"><a href="#">Nineteen Eighty-Four</a></li>
<li style="display: none;"><a href="#">Earth Abides</a></li>
<li style="display: none;"><a href="#">Foundation</a></li>
<li style="display: none;"><a href="#">The Illustrated Man</a></li>
<li style="display: none;"><a href="#">The Demolished Man</a></li>
<li style="display: none;"><a href="#">Ring Around the Sun</a></li>
<li style="display: none;"><a href="#">Mission of Gravity</a></li>
<li style="display: none;"><a href="#">The Long Tomorrow</a></li>
<li style="display: none;"><a href="#">The Chrysalids</a></li>
<li style="display: none;"><a href="#">The Death of Grass or No Blade of Grass</a></li>
<li style="display: none;"><a href="#">Starship Troopers</a></li>
<li style="display: none;"><a href="#">The Sirens of Titan</a></li>
<li style="display: none;"><a href="#">Alas, Babylon</a></li>
<li style="display: none;"><a href="#">A Canticle for Leibowitz</a></li>
<li style="display: none;"><a href="#">Venus Plus X</a></li>
<li style="display: none;"><a href="#">Solaris</a></li>
<li style="display: none;"><a href="#">The Drowned World</a></li>
<li style="display: none;"><a href="#">Hothouse</a></li>
<li style="display: none;"><a href="#">A Wrinkle in Time</a></li>
<li style="display: none;"><a href="#">Dune</a></li>
<li style="display: none;"><a href="#">Make Room! Make Room!</a></li>
<li style="display: none;"><a href="#">Logan's Run</a></li>
<li style="display: none;"><a href="#">Do Androids Dream of Electric Sheep?</a></li>
<li style="display: none;"><a href="#">The Left Hand of Darkness</a></li>
<li style="display: none;"><a href="#">Behold the Man</a></li>
<li style="display: none;"><a href="#">Ringworld</a></li>
<li style="display: none;"><a href="#">Rendezvous with Rama</a></li>
<li style="display: none;"><a href="#">Roadside Picnic / Tale of the Troika</a></li>
<li style="display: none;"><a href="#">The Female Man</a></li>
<li style="display: none;"><a href="#">Man Plus</a></li>
<li style="display: none;"><a href="#">The Stand</a></li>
<li style="display: none;"><a href="#">The Hitchhiker's Guide to the Galaxy</a></li>
<li style="display: none;"><a href="#">Nor Crystal Tears</a></li>
<li style="display: none;"><a href="#">Ender's Game</a></li>
<li style="display: none;"><a href="#">Consider Phlebas</a></li>
<li style="display: none;"><a href="#">Falling Free</a></li>
<li style="display: none;"><a href="#">Hyperion</a></li>
<li style="display: none;"><a href="#">Red Mars</a></li>
<li style="display: none;"><a href="#">Ribofunk</a></li>
<li style="display: none;"><a href="#">Cryptonomicon</a></li>
<li style="display: none;"><a href="#">Uglies</a></li>
<li style="display: none;"><a href="#">Old Man's War</a></li>
<li style="display: none;"><a href="#">Little Brother</a></li>
<li style="display: none;"><a href="#">Acme Novelty Library #19</a></li>
<li style="display: none;"><a href="#">Embassytown</a></li>
</ul>
<div id="resultsContainer">
</div>
</div>
<script src="function.js"></script>
</body>
</html>If you need any programming assignment help in PHP programming, PHP project or PHP homework or need solution of above problem then we are ready to help you.
Send your request at realcode4you@gmail.com and get instant help with an affordable price.
We are always focus to delivered unique or without plagiarism code which is written by our highly educated professional which provide well structured code within your given time frame.
If you are looking other programming language help like C, C++, Java, Python, PHP, Asp.Net, NodeJs, ReactJs, etc. with the different types of databases like MySQL, MongoDB, SQL Server, Oracle, etc. then also contact us.



Mình thấy mọi người nhắc nhiều nên cũng bấm vào xem thử cho biết, chủ yếu coi giao diện có dễ dùng không chứ không định ngồi khám phá kỹ. Lướt vài phút là thấy trang chia nội dung theo từng khối khá rõ ràng, nhìn phát biết đang ở phần nào, không bị rối mắt. Đang xem dở thì mình nhớ ra cái tên ao88.events nên đối chiếu thử, thấy cách trình bày cũng tương tự kiểu gọn gàng, dễ kéo xuống. Phần giới thiệu có nhắc kho game hơn 3000 tựa nên mình chỉ liếc qua cho vui, thấy họ sắp xếp dạng ô box nhìn khá ngăn nắp. Menu đặt chỗ dễ thấy, chuyển mục qua lại…
S8 COM hôm bữa mình lướt thử vì thấy bạn bè nhắc, kiểu vào xem giao diện ra sao thôi. Ấn tượng đầu là trang nhìn khá thoáng, chia khối rõ ràng nên mới vào không bị rối. Mình hay bị “lạc” ở mấy site nhiều thứ, mà ở đây cái menu đặt dễ thấy nên chuyển qua lại mấy mục nhanh, không phải kéo lên kéo xuống tìm. Phần thông tin cũng trình bày gọn theo dạng cột nên nhìn lướt là nắm được ý chính, không bị chữ đè chữ. Nói chung cảm giác họ làm theo kiểu ưu tiên người dùng mới, nhìn phát hiểu luôn. Mình thích nhất là cách họ bố trí các block nội…
rr88 dạo này mình thấy nhiều người nhắc vụ link giả nên lúc ghé thử cũng tự nhắc bản thân kiểm tra kỹ trước khi đăng nhập. Mình chỉ vào lướt xem giao diện thôi chứ không làm gì sâu, mà cảm giác trang này bố cục khá thoáng, nhìn không bị ngợp. Mấy phần nội dung chia theo khối rõ ràng nên đọc nhanh nắm ý được liền, kiểu kéo xuống là thấy từng mục tách bạch. Có đoạn cảnh báo về mấy trang giả mạo với chuyện không nên nhập thông tin bừa, đọc xong thấy cũng yên tâm hơn vì ít nhất họ nhắc thẳng luôn. Nói chung mình thích nhất là cách họ làm giao diện…
789BET mình vừa lướt thử vì thấy bạn bè nhắc, kiểu vào xem giao diện có dễ dùng không thôi. Ấn tượng đầu là trang nhìn khá “gọn”, mọi thứ được chia theo từng khối rõ ràng nên mắt không bị loạn khi kéo xuống. Mình hay ngại mấy site nhồi chữ, nhưng ở đây họ trình bày dạng danh sách ô thông tin nên đọc nhanh vẫn nắm được ý chính. Thanh menu cũng nằm chỗ dễ thấy, bấm qua lại mượt, không phải mất công tìm nút này nút kia. Nói chung cảm giác như họ ưu tiên cho người mới vào xem lướt cũng hiểu. Mình thích nhất là cách họ gom nội dung theo cụm và…
63c apareceu pra mim meio do nada e eu fui entrar só pra matar a curiosidade, achando que ia ser aquela bagunça cheia de coisa piscando. Mas a navegação é bem de boa: a interface é moderna e, pelo menos no meu teste, não travou quando fui alternando entre as áreas. No celular também me surpreendeu, porque fica tudo bem encaixado na tela e não rola aquela luta de ficar ampliando pra clicar. Outra coisa que notei é que eles tentam deixar as informações mais “na cara”, sem esconder muito, e isso ajuda a não ficar perdido. Não explorei tudo, mas dá pra ver que o site foi pensado pra ser rápido e direto, com um visual limpo. O que…