Question

In: Computer Science

I already have a database in phpMyAdmin and need to create an html/php "SEARCH" page to...

I already have a database in phpMyAdmin and need to create an html/php "SEARCH" page to retrieve the information from the database on to my localhost. Please post a php/html code that will create a search page and return the data from my phpmyadmin database. The 3 items I have on the database are first_name, last_name and birth_day.

Solutions

Expert Solution

<?php
$db_hostname = 'localhost';
$db_username = 'demo';
$db_password = 'demo';
$db_database = 'demo';

// Database Connection String
$con = mysql_connect($db_hostname,$db_username,$db_password);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($db_database, $con);
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
<form action="" method="post">  
Search: <input type="text" name="term" /><br />  
<input type="submit" value="Submit" />  
</form>  
<?php

$sql = 'SELECT first_name, last_name, birth_day FROM STUDENT';  /* Here you use your table name instead "STUDENT"*/
   mysql_select_db('test_db');
   $retval = mysql_query( $sql, $conn );
   
   if(! $retval ) {
      die('Could not get data: ' . mysql_error());
   }
   
   while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
      echo "First Name :{$row['first_name']}  <br> ".
         "Last Name : {$row['last_name']} <br> ".
         "Date Of Birth: {$row['birth_day']} <br> ".
         "--------------------------------<br>";
   }
   
   echo "Fetched data successfully\n";
   
   mysql_close($conn);
?>
?>
    </body>
</html>

Related Solutions

The code to create a Search/Filter Data with Javascript or html from html page.
The code to create a Search/Filter Data with Javascript or html from html page.
Create a web page using PHP and HTML that contains a list of movie names available...
Create a web page using PHP and HTML that contains a list of movie names available for rent (at least 10 movies), so that each time you visit the home page, you see a different order of movies in the list. The movie names are required. 2) The rental price for each movie ranges between $1.99 to $7.99. • Create an associative array with a code for the movie as the key (e.g., movie1, movie2, etc.) and the associated rental...
(a) Create a HTML page for a single faceted search selector. It will include the name...
(a) Create a HTML page for a single faceted search selector. It will include the name of the facet and a list of radio buttons or tick boxes for each category. (b) Add a button called filter. When the button is clicked the radio button or tick boxes will be read to determine if a selection has been made. The selection will be written to a div element located under the filterbutton. If no selection was made, then an appropriate...
I need assistance in making a simple html and php script that lets a user explor...
I need assistance in making a simple html and php script that lets a user explor the RGB color specturum. It should be able to use 6 buttons (R+,G+,B+,R-,G-,B-) that when pressed, add or subtract 2 points (ranging from 0-255) of that color from the RGB ratio. The new RGB color is then displayed in a small window/box at the bottom of the page for the user to see. This should allow the user to explore all the different colors...
Using PHP and MYSQL and with a simple customer database, how can I create a simple...
Using PHP and MYSQL and with a simple customer database, how can I create a simple log in and registration system for an ecommerce site
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
PHP, JAVASCRIPT, MYSQL below is what I have. Can fill in the details for the database...
PHP, JAVASCRIPT, MYSQL below is what I have. Can fill in the details for the database 5. “Login to DB”, “Logout DB”, sub-menus of “File” 5.1 _____ When the user selects “Login to DB”, a window should popup asking the user to enter login and password. Your program should verify the login and password against the DV_User table in the datamining database. A corresponding message should be shown in the message area when the login failed or successful. If it...
- Create an html form (bank form) and the PHP code with 2 accounts with options...
- Create an html form (bank form) and the PHP code with 2 accounts with options to transfer, deposit or withdraw money.
Write an Html Page that uses JavaScript Program to make a Blackjack Game. I need to...
Write an Html Page that uses JavaScript Program to make a Blackjack Game. I need to write an html file (P5.html) that uses JavaScript program to create a Blackjack game. 1. Blackjack Games Rules: a. The object of the game is to "beat the dealer", which can be done in a number of ways: • Get 21 points on your first two cards (called a blackjack), without a dealer blackjack; • Reach a final score higher than the dealer without...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT