Question

Instructions Using Php and MySQL, database from Xampp In this assignment, you will create an application...

Instructions

Using Php and MySQL, database from Xampp

In this assignment, you will create an application using PHP and MySQL, incorporating all of the skills that you have learned throughout the course.

As you complete the project, be sure that you are using the correct format and syntax as well as the appropriate structure for your coding.

To move forward to the next module, you will need to demonstrate mastery by scoring an 80% or higher. If you score less than 80%, your instructor will provide you will feedback and additional resources so that you may adjust and resubmit your project.

Project Instructions

The last Chapter in our text book is titled “Putting It All Together”, this is where we create the complete Application.  This last project requires you to create an application which will include the following elements:

  • Create a database
  • Create a script to connect to the database
  • Include script in the PHP pages that:
    • inserts data into the database
    • retrieves data in the database
    • deletes data from the database
    • updates data in the database
    • views data within the database
  • You will need to build the application to connect to your database, establish a login and logout procedure, and create the other necessary components to complete the application (hint: security and cookies).
  • The database can be the quotes database as referenced in the text book or you may create a database of your own choice. For example, instead of creating a quotes database you can create a database of tropical birds, or types of cars, or manufactures of computers/parts, or books recently read, etc. The database format for any of these ideas should not change, the character set size within the database should have a 100 character limit.    
  • Be sure to include setting the character set and security.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Connect to the Database:

<?php
   $servername = "localhost";
   $username = "root";
   $password = "";
   $dbname = "databasename";

   // Create connection
   $conn = mysqli_connect($servername, $username, $password, $dbname);
   if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
   }
?>

Inserts data into the Database:

<?php

    $conn = mysqli_connect($servername, $username, $password, $dbname);
   if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
   }

    $sql="insert query'"; //ex: insert into user values('userid','username','age')
   $result=mysqli_query($conn,$sql);
   if ($result) {

        echo "row inserted successfully";
        }
   }else{
        echo "error while inserting row";
   }

?>

Retrieves data in the Database:

<?php

    $conn = mysqli_connect($servername, $username, $password, $dbname);
   if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
   }

    $sql="select query'"; //select *from user
   $result=mysqli_query($conn,$sql);
   if (mysqli_num_rows($result) > 0) {
       while($row=mysqli_fetch_assoc($result)){

            echo "$row['column1_name']";

            echo "$row['column2_name']";

            //...................

        }
   }else{
        echo "no rows found";
   }

?>

Deletes data from the Database:

<?php

    $conn = mysqli_connect($servername, $username, $password, $dbname);
   if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
   }

    $sql="delete query'"; //ex: delete from user where userid='HomeworkLib'
   $result=mysqli_query($conn,$sql);
   if ($result) {

        echo "row deleted successfully";
        }
   }else{
        echo "error while deleting row";
   }

?>

Updates data in the Database:

<?php

    $conn = mysqli_connect($servername, $username, $password, $dbname);
   if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
   }

    $sql="update query'"; //ex: update user set username='HomeworkLibstudy' where userid='HomeworkLib'
   $result=mysqli_query($conn,$sql);
   if ($result) {

        echo "row updated successfully";
        }
   }else{
        echo "error while updating row";
   }

?>

Add a comment
Know the answer?
Add Answer to:
Instructions Using Php and MySQL, database from Xampp In this assignment, you will create an application...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MySQL 8 Create a PHP program that will read in each table of the database you...

    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);...

  • Create web pages for your database using PHP. You should have one page that will return...

    Create web pages for your database using PHP. You should have one page that will return all the information from the database. You should create additional pages that will allow you to do various queries of your database. You should be able to retrieve and insert data; also include functionality to delete data from your database. Create an html form that will allow you to enter in new information for the database. The information should be handled by a PHP...

  • Using PHP and MYSQL create a form that: user Full name user Comment (as many lines...

    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

  • Create a MySQL Database called “CSC306Class”. Create three (3) tables in the database called “studentInf”, “IntructorInf”,...

    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...

  • PHP Programming In this project, you will create a Web page that allows visitors to your...

    PHP Programming In this project, you will create a Web page that allows visitors to your site to sign a guest book that is saved to a database. Create a new document in your text editor and type the <!DOCTYPE> declaration, <html> element, document head, and <body> element. Use the strict DTD and “Guest Book” as the content of the <title> element. Add the following text and elements to the document body: <h2>Enter your name to sign our guest book</h2>...

  • Write a PHP script that obtains a URL and its description from user and stores the...

    Write a PHP script that obtains a URL and its description from user and stores the information into a database using MySQL. Create and run a SQL script with database named URL and a table named Urltable. The first field of the table should contain an actual URL, and the second, which is named Description, should contain a description of the URL. Use www.deitel.com as the first URL, and input Cool site! as its description. The second URL should be...

  • Using the MySQL Workbench create a new database using your design specifications Add at least 10...

    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...

  • You need to implement a web application that is split in three parts, namely, Webpage, PHP...

    You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...

  • Using MySQL and PHP keep it simple This assignment you will be making a form that...

    Using MySQL and PHP keep it simple This assignment you will be making a form that will do one of three things in a database -          It will add a record -          It will update a record -          It will search for a record Your database will contain a table for keeping a record of all your friends and family and should contain: First name Last name Phone number Address City State Zip Birthdate Username Password The sex of the...

  • Using PHP and MySQL, create a Web page to be used for storing software development bug reports in...

    Using PHP and MySQL, create a Web page to be used for storing software development bug reports in a MySQL database. Include fields such as product name and version, type of hardware, operating system, frequency of occurrence, and proposed solutions. Include links on the main page that allow you to create a new bug report and update an existing bug report. I have tried the various solutions provided previously for this exercise, but it does not work because every author...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT