The local farmers are having problems with some pesky crows eating their crops.
ID: 3856913 • Letter: T
Question
The local farmers are having problems with some pesky crows eating their crops. As a counter-measure, they have decided to concoct some pretty scary scarecrows; in fact, most of the farmers will be constructing multiple scarecrows for their fields. To make one scarecrow, they need one pumpkin for the head, some nuts for the eyes and mouth, and a carrot for the nose. At the local Farmer’s Market everyone is selling Halloween items, but the farmers all stop at Farmer Fred’s stand because he is selling everything that they need.
Because of the increased demand for pumpkins, nuts, and carrots, Farmer Fred has asked for your help. He needs a way of displaying an up-to-date record of all the pumpkins, nuts and carrots he has in stock. Your job is to create a web-based mini-application to do this, as follows: (Write your mysql command for each of the following questions respectively and number them clearly.)
Create a new database with the name: FredBiz
Using a single command, create a new user named “Fred” with a password of “Farmer#Fred.” He should have full access to the FredBiz database but no other. You should use Farmer Fred’s account to access the database in your web application
As user Fred (don’t forget to reinitialize the log file), login to mysql and create a table in FredBiz named “Halloween” with the following columns:
o id (INTEGER)
o qty (INTEGER)
o description (VARCHAR(20))
o weight (INTEGER)
* Enter the following records into the Halloween table:
id qty description weight
1 20 pumpkin 10
2 43 mixed nuts 2
3 25 pumpkin 15
4 87 bag carrots 1
5 9 pumpkin 20
6 52 mixed nuts 1
7 68 bag carrots 2
8 5 pumpkin 25
As user Fred, login to mysql and create a table in FredBiz named “users” with the following columns:
o id (INTEGER)
o username (VARCHAR(20))
o password (VARCHAR(16))
* Enter the following records into the Halloween table:
Write a login page that will enable the user to register. For returning users such as "batman" or "jdoe", once they enter the correct username and password information they will go to the next page to specify what he/she is looking for. Please note that this next page and all the following pages should contain the username information as long as he/she is in the session.
Write an input form that will ask the user for the item he/she is looking for. Use a heading at the top that says “Fred’s Market Biz” and a smaller subheading that says “Current Inventory.”
The form should contain a text input control to enter a description of the desired item. You may use a select input control or radio buttons to choose the desired item if you prefer.
Write the corresponding target script of Fred’s MarketBiz “Current Inventory” page. The target script should contain the same heading at the top and have the same overall look and feel as the previous page with the input form. As a subheading, this page should display the name of the item the application was looking for, followed by a nicely-formatted table that contains a list of id’s, qty’s and weights of all matching items. The table headers should clearly state the information in the columns, specifying that the weight is in pounds (lbs).
Don’t forget to account for the possibility that there are no records for that item. Somewhere on the target page, put a link or a button to allow Fred to return to the original page with the input form easily.
The application should also be able to let the user who is in the system to enter new information to the “Halloween” table and to delete old information from it. Add additional buttons or links if needed.
Once the user finishes with the pages, he/she should be able to log out from the application.
Create a CSS file (external) to have the same visual effect on the web application.
Generate the MYSQL dump file for the database and its content.
Make sure to send in only one zipped file which contains
* All php, html, css, js, MYSQL dump file, and other source files necessary to implement fully the web interface.
* A text file containing any notes I will need to get started, like usernames/passwords and where to begin
Explanation / Answer
AddUser.php
---------------------------
<?php
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="users"; // Table name
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name") or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
// encrypt password using MD5 hash
$encrypted_mypassword=md5($mypassword);
$sql="INSERT INTO $tbl_name (username, password) VALUES ('$myusername', '$encrypted_mypassword')";
$result=mysqli_query($con,$sql);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$encrypted_mypassword'";
$result=mysqli_query($con,$sql);
// Mysql_num_row is counting table row
$count=mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
$Message= $myusername." you account was created successfully <br> Click your brownsers back button to login";
}
else {
$Message= "User was not registered";
}
mysqli_close($con);
?>
<html>
<head>
<title> Fred’s Market Biz Login </title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
echo $Message;
?>
</body>
</html>
-------------------------------------------------------------------------------------------------
CheckLogin.php
---------------------------
<?php
session_start();
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="users"; // Table name
$_SESSION['LoginFail'] ="False"; //login failure sentinel value
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$encrypted_mypassword=md5($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$encrypted_mypassword'";
$result=mysqli_query($con,$sql);
// Mysql_num_row is counting table row
$count=mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['myusername'] = $myusername;
$_SESSION['mypassword'] = $encrypted_mypassword;
$_SESSION['LoginBool'] = "False";
header("location:DescSelect.php");
}
else {
$_SESSION['LoginFail'] = "True";
header("location:LoginPage.php");
}
mysqli_close($con);
?>
-------------------------------------------------------------------------------------------------
DescSelect.php
---------------------------
<?php
session_start();
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="halloween"; // Table name
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
<html>
<head>
<title> Fred’s Market Biz Item Type Select</title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
echo "You are currently logged in as ".$_SESSION['myusername'];
?>
<!-- Logout button -->
<form name="LoginForm" method="post" action="Logout.php">
<input type="submit" name="Submit" value="Logout">
</form>
<h1>Fred's Market Biz</h1>
<table>
<tr>
<form name="ItemSelect" method="post" action="QttySelect.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Items for Sale</strong></td>
</tr>
<tr>
<td>
<?php
// connect for the database
$column = "description";
$sql= "SELECT DISTINCT $column FROM $tbl_name";
$result=mysqli_query($con,$sql);
// Start while loop to get item types
while ($row = mysqli_fetch_array($result)){
$ItemName = $row[$column];
?>
<input type="radio" value="<?php echo $ItemName; ?>" name='description'><?php echo $ItemName; ?><br>
<?php } //end while loop ?>
</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</td>
</form>
<tr>
<td>
<a href="UpdateQtty.php">Update Inventory</a>
</td>
</tr>
</tr>
</table>
</body>
</html>
<?php
// close the sql connection
mysqli_close($con);
?>
-------------------------------------------------------------------------------------------------
InvAdd.php
---------------------------
<?php
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="halloween"; // Table name
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// data sent from form
$ItemQty = $_POST['ItemQty'];
$ItemDesc = $_POST['ItemDesc'];
$ItemWeight = $_POST['ItemWeight'];
// To protect MySQL injection (more detail about MySQL injection)
$ItemQty = stripslashes($ItemQty);
$ItemDesc = stripslashes($ItemDesc);
$ItemWeight = stripslashes($ItemWeight);
$ItemQty = mysql_real_escape_string($ItemQty);
$ItemDesc = mysql_real_escape_string($ItemDesc);
$ItemWeight = mysql_real_escape_string($ItemWeight);
$sql="INSERT INTO $tbl_name (qty, description, weight)
VALUES ($ItemQty ,'$ItemDesc' ,$ItemWeight)";
if (mysqli_query($con,$sql)) {
echo "New record created successfully";
header("location:UpdateQtty.php");
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
?>
-------------------------------------------------------------------------------------------------
InvDel.php
---------------------------
<?php
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="halloween"; // Table name
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// data sent from form
$ItemId = $_POST['ItemId'];
// To protect MySQL injection (more detail about MySQL injection)
$ItemId = stripslashes($ItemId);
$ItemId = mysql_real_escape_string($ItemId);
$ItemId = (int)$ItemId;
$sql="DELETE FROM $tbl_name WHERE id=$ItemId";
if (mysqli_query($con,$sql)) {
echo "Record removed successfully";
header("location:UpdateQtty.php");
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
?>
-------------------------------------------------------------------------------------------------
InvUpd.php
---------------------------
<?php
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="halloween"; // Table name
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// data sent from form
$ItemId = $_POST['ItemId'];
$ItemQty = $_POST['ItemQty'];
$ItemDesc = $_POST['ItemDesc'];
$ItemWeight = $_POST['ItemWeight'];
// To protect MySQL injection (more detail about MySQL injection)
$ItemId = stripslashes($ItemId);
$ItemQty = stripslashes($ItemQty);
$ItemDesc = stripslashes($ItemDesc);
$ItemWeight = stripslashes($ItemWeight);
$ItemId = mysql_real_escape_string($ItemId);
$ItemQty = mysql_real_escape_string($ItemQty);
$ItemDesc = mysql_real_escape_string($ItemDesc);
$ItemWeight = mysql_real_escape_string($ItemWeight);
$sql="UPDATE $tbl_name SET qty=$ItemQty, description='$ItemDesc', weight=$ItemWeight WHERE id=$ItemId";
if (mysqli_query($con,$sql)) {
echo "New record created successfully";
header("location:UpdateQtty.php");
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
?>
-------------------------------------------------------------------------------------------------
LoginPage.php
---------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fred's Market Biz</title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Fred's Market Biz </h1>
<table>
<tr>
<form name="LoginForm" method="post" action="CheckLogin.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Login</strong></td>
</tr>
<?php
session_start();
if(isset($_SESSION['LoginFail'])){
if($_SESSION['LoginFail'] == "True"){
echo "<tr>
<td colspan='2'><strong>Login Failed</strong></td>
</tr>";
}
}
?>
<tr>
<td>Username</td>
<td><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
<tr>
<form name="RegisterForm" method="post" action="AddUser.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Register</strong></td>
</tr>
<tr>
<td>Username</td>
<td><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Register"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>
-------------------------------------------------------------------------------------------------
Logout.php
---------------------------
<?php
session_start();
session_destroy();
?>
<html>
<head>
<title> Fred’s Market Biz Logout</title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
Logout Successful <br>
To log back in click the link below <br>
<a href="LoginPage.php">Log Back In</a>
</body>
</html>
-------------------------------------------------------------------------------------------------
QttySelect.php
---------------------------
<?php
session_start();
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="halloween"; // Table name
$item = $_POST['description'];
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
<html>
<head>
<title> Fred’s Market Biz Update Inventory</title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
echo "You are currently logged in as ".$_SESSION['myusername'];
?>
<!-- Logout button -->
<form name="LoginForm" method="post" action="Logout.php">
<input type="submit" name="Submit" value="Logout">
</form>
<h1>Fred's Market Biz</h1>
<table>
<tr>
<td>
<table>
<tr>
<td colspan="3" align="center"><strong>Update Inventory</strong></td>
</tr>
<tr>
<td>Item Id</td>
<td>Item Description</td>
<td>Item Qty.</td>
<td>Item Weight (Lbs.)</td>
</tr>
<?php
// connect for the database using the column name selected in DescSelect.php
$column = "description";
$sql= "SELECT * FROM $tbl_name WHERE $column = '$item'";
$result=mysqli_query($con,$sql);
// Start while loop to get item types
while ($row = mysqli_fetch_assoc($result)){
$ItemId = $row['id'];
$ItemQty = $row['qty'];
$ItemWeight = $row['weight'];
echo "
<tr align='center'>
<td>$ItemId</td>
<td>$ItemQty</td>
<td>$ItemWeight</td>
</tr>
";
} //end while loop
?>
</table>
</td>
</tr>
<tr>
<td>
<a href="DescSelect.php">Select a different item.</a>
</td>
</tr>
<tr>
<td>
<a href="UpdateQtty.php">Update Inventory</a>
</td>
</tr>
</table>
</body>
</html>
-------------------------------------------------------------------------------------------------
Register.php
---------------------------
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Fred’s Market Biz Login </title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table>
<tr>
<form name="form1" method="post" action="AddUser.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Fred’s Market Biz Registration</strong></td>
</tr>
<tr>
<td>Username</td>
<td><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Register"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>
----------------------------------
UpdateQtty.php
---------------------------
<?php
session_start();
$host="localhost"; // Host name
$username="Fred"; // Mysql username
$password="Farmer#Fred."; // Mysql password
$db_name="FredBiz"; // Database name
$tbl_name="halloween"; // Table name
$item = "description";
// Connect to server and select databse.
$con = mysqli_connect("$host", "$username", "$password", "$db_name")or die("cannot connect");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();}
?>
<html>
<head>
<title> Fred’s Market Biz Item Type Select</title>
<link rel="stylesheet" type="text/css" href="Style.css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
echo "You are currently logged in as ".$_SESSION['myusername'];
?>
<!-- Logout button -->
<form name="LoginForm" method="post" action="Logout.php">
<input type="submit" name="Submit" value="Logout">
</form>
<h1>Fred's Market Biz</h1>
<table>
<tr>
<td>
<table>
<tr>
<td colspan="3" align="center"><strong>Items for Sale</strong></td>
</tr>
<tr>
<td>Item Id</td>
<td>Item Qty.</td>
<td>Item Desc.</td>
<td>Item Weight (Lbs.)</td>
</tr>
<?php
// connect for the database using the column name selected in DescSelect.php
$column = "description";
$sql= "SELECT * FROM $tbl_name ORDER BY $tbl_name.`description` ASC ,`weight` ASC";
$result=mysqli_query($con,$sql);
// Start while loop to get item types
while ($row = mysqli_fetch_assoc($result)){
$ItemId = $row['id'];
$ItemQty = $row['qty'];
$ItemDesc = $row['description'];
$ItemWeight = $row['weight'];
echo "
<tr align='center'>
<td>$ItemId</td>
<td>$ItemQty</td>
<td>$ItemDesc</td>
<td>$ItemWeight</td>
</tr>
";
} //end while loop
?>
</table>
</td>
</tr>
<tr>
<form name="DataUpdateForm" method="post" action="InvAdd.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Add Inventory</strong></td>
</tr>
<tr>
<td>Item Qty.</td>
<td><input name="ItemQty" type="text" id="ItemQty"></td>
</tr>
<tr>
<td>Item Desc.</td>
<td><input name="ItemDesc" type="text" id="ItemDesc"></td>
</tr>
<tr>
<td>Item Weight (Lbs.)</td>
<td><input name="ItemWeight" type="text" id="ItemWeight"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Add Inventory"></td>
</tr>
</table>
</td>
</form>
</tr>
<tr>
<form name="DataUpdateForm" method="post" action="InvUpd.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Update Inventory</strong></td>
</tr>
<tr>
<td>Item Id</td>
<td>
<?php
$sql= "SELECT id FROM $tbl_name ORDER BY $tbl_name.`id` ASC";
$result=mysqli_query($con,$sql);
echo "<select name=ItemId value=''>Item Id</option>";
while ($row = mysqli_fetch_assoc($result)){
$ItemId = $row['id'];
echo "<option value='$ItemId'>$ItemId</option>"; }
echo "</select>";
?>
</td>
</tr>
<tr>
<td>Item Qty.</td>
<td><input name="ItemQty" type="number" id="ItemQty"></td>
</tr>
<tr>
<td>Item Desc.</td>
<td><input name="ItemDesc" type="text" id="ItemDesc"></td>
</tr>
<tr>
<td>Item Weight (Lbs.)</td>
<td><input name="ItemWeight" type="number" id="ItemWeight"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Update"></td>
</tr>
</table>
</td>
</form>
</tr>
<tr>
<form name="DataUpdateForm" method="post" action="InvDel.php">
<td>
<table>
<tr>
<td colspan="2"><strong>Remove Inventory</strong></td>
</tr>
<tr>
<td>Item Id</td>
<td>
<?php
$sql= "SELECT id FROM $tbl_name ORDER BY $tbl_name.`id` ASC";
$result=mysqli_query($con,$sql);
echo "<select name=ItemId value=''>Item Id</option>";
while ($row = mysqli_fetch_assoc($result)){
$ItemId = $row['id'];
echo "<option value='$ItemId'>$ItemId</option>";
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Delete Inventory"></td>
</tr>
</table>
</td>
</form>
</tr>
<tr>
<td>
<a href="DescSelect.php">Select a different item to display</a>
</td>
</tr>
</table>
</body>
</html>
----------------------------------
-- Host: localhost Database: fredbiz
-- ------------------------------------------------------
-- Server version 5.6.20
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `halloween`
--
DROP TABLE IF EXISTS `halloween`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `halloween` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`qty` int(11) DEFAULT NULL,
`description` varchar(20) DEFAULT NULL,
`weight` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `halloween`
--
LOCK TABLES `halloween` WRITE;
/*!40000 ALTER TABLE `halloween` DISABLE KEYS */;
INSERT INTO `halloween` VALUES (1,20,'pumpkin',10),(2,43,'mixed nuts',2),(3,25,'pumpkin',15),(4,87,'bag carrots',1),(5,9,'pumpkin',20),(6,52,'mixed nuts',1),(7,68,'bag carrots',2),(8,5,'pumpkin',25);
/*!40000 ALTER TABLE `halloween` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) DEFAULT NULL,
`password` char(32) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `password` (`password`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'batman','b51a4ad33cbd2c22f8196ae4857337b2'),(2,'jdoe','9c86d448e84d4ba23eb089e0b5160207');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.