(Solved) : Bit Trouble Creating Project Hopefully Someone Help Guide Design App Site Allow Users Vote Q30155314 . . .
I am having a bit of trouble creating this project, hopefullysomeone can help guide me!
Design an app / site that allow users to vote on their favoritebaby names and displays updated statistics of the most popular babynames. It should demonstrate your knowledge of (primarily) PHP, andMySQL and build upon your existing knowledge of HTML, CSS,Bootstrap, JavaScript, and jQuery.





———————————————–TABLETEST.PHP——————————————-
<?php
require_once ‘./php/db_connect.php’;
?>
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width,initial-scale=1″>
<title>DB Table Test</title>
<linkhref=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css”rel=”stylesheet”>
</head>
<body>
<div class=”container”>
<div class=”page-header”>
<h1>Database Table Test</h1>
</div>
<?php
// Create table with two columns: id and value
$createStmt = ‘CREATE TABLE `TEST` (‘ . PHP_EOL
. ‘ `id` int(11) NOT NULL AUTO_INCREMENT,’ . PHP_EOL
. ‘ `value` varchar(50) DEFAULT NULL,’ . PHP_EOL
. ‘ PRIMARY KEY (`id`)’ . PHP_EOL
. ‘) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;’;
?>
<div id=”step-one” class=”well”>
<h3>Step One <small>Creating thetable</small></h3>
<pre><?php echo $createStmt; ?></pre>
<?php
if($db->query($createStmt)) {
echo ‘ <div class=”alert alert-success”>Table creationsuccessful.</div>’ . PHP_EOL;
} else {
echo ‘ <div class=”alert alert-danger”>Table creation failed:(‘ . $db->errno . ‘) ‘ . $db->error . ‘</div>’ .PHP_EOL;
exit(); // Prevents the rest of the file from running
}
?>
</div>
<?php
// Add two rows to the table
$insertStmt = ‘INSERT INTO `TEST` (`id`, `value`)’ . PHP_EOL
. ‘ VALUES (NULL, ‘Test 1′),’ . PHP_EOL
. ‘ (NULL, ‘Lorem Ipsum’);’;
?>
<div id=”step-two” class=”well”>
<h3>Step Two <small>Inserting into thetable</small></h3>
<pre><?php echo $insertStmt; ?></pre>
<?php
if($db->query($insertStmt)) {
echo ‘ <div class=”alert alert-success”>Values insertedsuccessfully.</div>’ . PHP_EOL;
} else {
echo ‘ <div class=”alert alert-danger”>Value insertionfailed: (‘ . $db->errno . ‘) ‘ . $db->error . ‘</div>’. PHP_EOL;
exit();
}
?>
</div>
<?php
// Get the rows from the table
$selectStmt = ‘SELECT * FROM `TEST`;’;
?>
<div id=”step-three” class=”well”>
<h3>Step Three <small>Retrieving therows</small></h3>
<pre><?php echo $selectStmt; ?></pre>
<?php
$result = $db->query($selectStmt);
if($result->num_rows > 0) {
echo ‘ <div class=”alert alert-success”>’ . PHP_EOL;
while($row = $result->fetch_assoc()) {
echo ‘ <p>id: ‘ . $row[“id”] . ‘ – value: ‘ . $row[“value”] .'</p>’ . PHP_EOL;
}
echo ‘ </div>’ . PHP_EOL;
} else {
echo ‘ <div class=”alert alert-success”>NoResults</div>’ . PHP_EOL;
}
?>
</div>
<?php
// Drop the TEST table now that we’re done with it
$dropStmt = ‘DROP TABLE `TEST`;’;
?>
<div id=”step-four” class=”well”>
<h3>Step Four <small>Dropping thetable</small></h3>
<pre><?php echo $dropStmt; ?></pre>
<?php
if($db->query($dropStmt)) {
echo ‘ <div class=”alert alert-success”>Table dropsuccessful.</div>’ . PHP_EOL;
} else {
echo ‘ <div class=”alert alert-danger”>Table drop failed: (‘. $db->errno . ‘) ‘ . $db->error . ‘</div>’ .PHP_EOL;
exit();
}
?>
</div>
</div>
</body>
</html>
—————————————db_connect.php——————————————
<?php
// Do not change the following two lines.
$teamURL = dirname($_SERVER[‘PHP_SELF’]) .DIRECTORY_SEPARATOR;
$server_root = dirname($_SERVER[‘PHP_SELF’]);
// You will need to require this file on EVERY php file thatuses the database.
// Be sure to use $db->close(); at the end of each php file thatincludes this!
$dbhost = ‘localhost’; // Most likely will not need to bechanged
$dbname = ‘FAU Username’; // Needs to be changed to your designatedtable database name
$dbuser = ‘FAU Username’; // Needs to be changed to reflect yourLAMP server credentials
$dbpass = ‘DB Password’; // Needs to be changed to reflect yourLAMP server credentials
$db = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if($db->connect_errno > 0) {
die(‘Unable to connect to database [‘ . $db->connect_error .’]’);
}
Milestone 1: connection with database (starter code: ‘tableTest’) 2. Download the tableTest.zip file from Blackboard. It consists of two files: tabletest.php and (under directory php) db_connect.php 3. Update your db_connect.php file with your proper credentials. 4. Upload the two files (maintaining the proper directory structure) to your area on the server. 5 Run tabletest.php to test if you can successfully connect to the database. It should show the following: Show transcribed image text
Expert Answer
Answer to Bit Trouble Creating Project Hopefully Someone Help Guide Design App Site Allow Users Vote Q30155314 . . .
OR