Presentation is loading. Please wait.

Presentation is loading. Please wait.

Application Sketch home.htm delete.php updateform.php display.php insert.php insertform.htm update.php Data Base Hyperlink Information exchange with database.

Similar presentations


Presentation on theme: "Application Sketch home.htm delete.php updateform.php display.php insert.php insertform.htm update.php Data Base Hyperlink Information exchange with database."— Presentation transcript:

1 Application Sketch home.htm delete.php updateform.php display.php insert.php insertform.htm update.php Data Base Hyperlink Information exchange with database Redirection Submit data via post Hyperlink with URL appended data

2 home.html Untitled Document Main Home Page View Records Enter Records

3 insertform.htm Untitled Document home Name Age

4 insert.php <? // script to display all the records in a table // connection information $hostName = "dbm1.itc.virginia.edu"; $userName = “user"; $password = “password"; $dbName = “dbname"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Insert Data into table1 $query = "INSERT INTO table1 (name, age) VALUES ('$name', '$age')"; $result = mysql_query($query); // Close the database connection mysql_close(); header("Location: home.htm"); ?>

5 display.php (part 1) Data Display home <? // script to display all the records in a table // connection information $hostName = "dbm1.itc.virginia.edu"; $userName = “user"; $password = “password"; $dbName = “dbname"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Select all the fields in all the records of table1 $query = "SELECT * FROM table1 ORDER BY ID"; $result = mysql_query($query);

6 display.php (part 2) // Determine the number of employees $number = mysql_numrows($result); // Print the employee names echo("There are $number employees: "); $i = 0; While ($i<$number) { $ID = mysql_result($result,$i, "ID"); $name = mysql_result($result,$i, "name"); $age = mysql_result($result,$i, "age"); echo(" Update $name $age Delete "); $i = $i + 1; } // Close the database connection mysql_close(); ?>

7 updateform.php Untitled Document home Name "> Age ">

8 update.php <? // script to display all the records in a table // connection information $hostName = "dbm1.itc.virginia.edu"; $userName = “user"; $password = “password"; $dbName = “dbname"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Select all the fields in all the records of table1 $query = "UPDATE table1 SET name = '$name', age = '$age' WHERE ID = '$ID'"; $result = mysql_query($query); // Close the database connection mysql_close(); header("Location: display.php"); ?>

9 delete.php <? // script to display all the records in a table // connection information $hostName = "dbm1.itc.virginia.edu"; $userName = “user"; $password = “password"; $dbName = “dbname"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Select all the fields in all the records of table1 $query = "DELETE FROM table1 WHERE ID = '$ID'"; $result = mysql_query($query); // Close the database connection mysql_close(); header("Location: display.php"); ?>


Download ppt "Application Sketch home.htm delete.php updateform.php display.php insert.php insertform.htm update.php Data Base Hyperlink Information exchange with database."

Similar presentations


Ads by Google