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
home.html <html> <head> <title>Untitled Document</title> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;../home.htm&quot;>Main Home Page</a></p> <p><a href=&quot;display.php&quot;>View Records</a></p> <p><a href=“insertform.htm&quot;>Enter Records</a></p> </body> </html>
insertform.htm <html> <head> <title>Untitled Document</title> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;home.htm&quot;>home</a></p> <form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;insert.php&quot;> <p>Name  <input type=&quot;text&quot; name=&quot;name&quot;> </p> <p>Age  <input type=&quot;text&quot; name=&quot;age&quot;> </p> <p> <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;> </p> </form> </body> </html>
insert.php <? // script to display all the records in a table  // connection information  $hostName =  &quot;dbm1.itc.virginia.edu&quot;; $userName =  “user&quot;; $password =  “password&quot;; $dbName =  “dbname&quot;; // make connection to database  mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;);  // Insert Data into table1  $query =  &quot;INSERT INTO table1 (name, age) VALUES ('$name', '$age')&quot;; $result = mysql_query($query); // Close the database connection  mysql_close(); header(&quot;Location: home.htm&quot;); ?>
display.php (part 1) <html> <head> <title>Data Display</title> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;home.htm&quot;>home</a></p> <p>  <? // script to display all the records in a table  // connection information  $hostName =  &quot;dbm1.itc.virginia.edu&quot;; $userName =  “user&quot;; $password =  “password&quot;; $dbName =  “dbname&quot;; // make connection to database  mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;);  // Select all the fields in all the records of table1  $query =  &quot;SELECT * FROM table1 ORDER BY ID&quot;; $result = mysql_query($query);
display.php (part 2) // Determine the number of employees  $number = mysql_numrows($result); // Print the employee names  echo(&quot;There are $number employees:<p>&quot;); $i = 0; While ($i<$number) { $ID = mysql_result($result,$i, &quot;ID&quot;); $name = mysql_result($result,$i, &quot;name&quot;); $age = mysql_result($result,$i,  &quot;age&quot;); echo(&quot;<a href=\&quot;updateform.php?ID=$ID&name=$name&age=$age\&quot;>Update</a> $name $age <a href=\&quot;delete.php?ID=$ID\&quot;>Delete</a><br>&quot;); $i = $i + 1; } // Close the database connection  mysql_close(); ?> </p> </body> </html>
updateform.php <html> <head> <title>Untitled Document</title> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;home.htm&quot;>home</a></p> <form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;update.php&quot;> <p>Name  <input type=&quot;text&quot; name=&quot;name&quot; value=&quot;<? echo(&quot;$name&quot;)?>&quot;> <input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;<? echo(&quot;$ID&quot;)?>&quot;> </p> <p>Age  <input type=&quot;text&quot; name=&quot;age&quot; value=&quot;<? echo(&quot;$age&quot;)?>&quot;> </p> <p> <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;> </p> </form> <p>&nbsp;</p> </body> </html>
update.php <? // script to display all the records in a table  // connection information  $hostName =  &quot;dbm1.itc.virginia.edu&quot;; $userName =  “user&quot;; $password =  “password&quot;; $dbName =  “dbname&quot;; // make connection to database  mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;);  // Select all the fields in all the records of table1  $query =  &quot;UPDATE table1 SET name = '$name', age = '$age' WHERE ID = '$ID'&quot;; $result = mysql_query($query); // Close the database connection  mysql_close(); header(&quot;Location: display.php&quot;); ?>
delete.php <? // script to display all the records in a table  // connection information  $hostName =  &quot;dbm1.itc.virginia.edu&quot;; $userName =  “user&quot;; $password =  “password&quot;; $dbName =  “dbname&quot;; // make connection to database  mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;);  // Select all the fields in all the records of table1  $query =  &quot;DELETE FROM table1 WHERE ID = '$ID'&quot;; $result = mysql_query($query); // Close the database connection  mysql_close(); header(&quot;Location: display.php&quot;); ?>

More Related Content

PPT
Pertemuan 8 - Report Tabel
PPT
Ph pmysql
PPTX
Form Script
DOCX
Freddy,teto,chino,jhovany
PPTX
12.eloquent in Laravel
DOCX
Documentacion De Mi Pagina
TXT
A z railphp v1.0
PDF
Pertemuan 8 - Report Tabel
Ph pmysql
Form Script
Freddy,teto,chino,jhovany
12.eloquent in Laravel
Documentacion De Mi Pagina
A z railphp v1.0

What's hot (20)

DOC
Sumahex
DOC
Sumahexavector
TXT
Func
KEY
File API in Firefox3.6
DOCX
Simular un next del recordset en php de forma rudimentaria
PDF
Clase 10 electiva profesional 3 aws rds php y mysql
PDF
Web Programming - Toko Bunga Red Flower
PDF
Doa karnival kantin
DOCX
Paginacion
TXT
With enter
PDF
Η ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 12 (ΕΚΤΥΠΩΣΗ)
PDF
Teacher's Film Tells Story about So. Amboy Explosion (The Suburban)
DOC
PDF
Verbo POUPAR
DOCX
Un juego creado en php
PDF
Php & mysql
TXT
Apn log
ODP
Construcción de Extensiones y Jetpacks
PDF
Portafolio catalina roa cortès
Sumahex
Sumahexavector
Func
File API in Firefox3.6
Simular un next del recordset en php de forma rudimentaria
Clase 10 electiva profesional 3 aws rds php y mysql
Web Programming - Toko Bunga Red Flower
Doa karnival kantin
Paginacion
With enter
Η ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 12 (ΕΚΤΥΠΩΣΗ)
Teacher's Film Tells Story about So. Amboy Explosion (The Suburban)
Verbo POUPAR
Un juego creado en php
Php & mysql
Apn log
Construcción de Extensiones y Jetpacks
Portafolio catalina roa cortès

More from webhostingguy (20)

PPT
File Upload
PDF
Running and Developing Tests with the Apache::Test Framework
PDF
MySQL and memcached Guide
PPT
Novell® iChain® 2.3
PDF
Load-balancing web servers Load-balancing web servers
PDF
SQL Server 2008 Consolidation
PDF
What is mod_perl?
PDF
What is mod_perl?
PDF
Master Service Agreement
PPT
PPT
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PDF
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
PPT
Managing Diverse IT Infrastructure
PPT
Web design for business.ppt
PPS
IT Power Management Strategy
PPS
Excel and SQL Quick Tricks for Merchandisers
PPT
OLUG_xen.ppt
PPT
Parallels Hosting Products
PPT
Microsoft PowerPoint presentation 2.175 Mb
PDF
Reseller's Guide
File Upload
Running and Developing Tests with the Apache::Test Framework
MySQL and memcached Guide
Novell® iChain® 2.3
Load-balancing web servers Load-balancing web servers
SQL Server 2008 Consolidation
What is mod_perl?
What is mod_perl?
Master Service Agreement
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
Dell Reference Architecture Guide Deploying Microsoft® SQL ...
Managing Diverse IT Infrastructure
Web design for business.ppt
IT Power Management Strategy
Excel and SQL Quick Tricks for Merchandisers
OLUG_xen.ppt
Parallels Hosting Products
Microsoft PowerPoint presentation 2.175 Mb
Reseller's Guide

databaseapplication.ppt

  • 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 <html> <head> <title>Untitled Document</title> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;../home.htm&quot;>Main Home Page</a></p> <p><a href=&quot;display.php&quot;>View Records</a></p> <p><a href=“insertform.htm&quot;>Enter Records</a></p> </body> </html>
  • 3. insertform.htm <html> <head> <title>Untitled Document</title> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;home.htm&quot;>home</a></p> <form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;insert.php&quot;> <p>Name <input type=&quot;text&quot; name=&quot;name&quot;> </p> <p>Age <input type=&quot;text&quot; name=&quot;age&quot;> </p> <p> <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;> </p> </form> </body> </html>
  • 4. insert.php <? // script to display all the records in a table // connection information $hostName = &quot;dbm1.itc.virginia.edu&quot;; $userName = “user&quot;; $password = “password&quot;; $dbName = “dbname&quot;; // make connection to database mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;); // Insert Data into table1 $query = &quot;INSERT INTO table1 (name, age) VALUES ('$name', '$age')&quot;; $result = mysql_query($query); // Close the database connection mysql_close(); header(&quot;Location: home.htm&quot;); ?>
  • 5. display.php (part 1) <html> <head> <title>Data Display</title> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;home.htm&quot;>home</a></p> <p> <? // script to display all the records in a table // connection information $hostName = &quot;dbm1.itc.virginia.edu&quot;; $userName = “user&quot;; $password = “password&quot;; $dbName = “dbname&quot;; // make connection to database mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;); // Select all the fields in all the records of table1 $query = &quot;SELECT * FROM table1 ORDER BY ID&quot;; $result = mysql_query($query);
  • 6. display.php (part 2) // Determine the number of employees $number = mysql_numrows($result); // Print the employee names echo(&quot;There are $number employees:<p>&quot;); $i = 0; While ($i<$number) { $ID = mysql_result($result,$i, &quot;ID&quot;); $name = mysql_result($result,$i, &quot;name&quot;); $age = mysql_result($result,$i, &quot;age&quot;); echo(&quot;<a href=\&quot;updateform.php?ID=$ID&name=$name&age=$age\&quot;>Update</a> $name $age <a href=\&quot;delete.php?ID=$ID\&quot;>Delete</a><br>&quot;); $i = $i + 1; } // Close the database connection mysql_close(); ?> </p> </body> </html>
  • 7. updateform.php <html> <head> <title>Untitled Document</title> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;> </head> <body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;> <p><a href=&quot;home.htm&quot;>home</a></p> <form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;update.php&quot;> <p>Name <input type=&quot;text&quot; name=&quot;name&quot; value=&quot;<? echo(&quot;$name&quot;)?>&quot;> <input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;<? echo(&quot;$ID&quot;)?>&quot;> </p> <p>Age <input type=&quot;text&quot; name=&quot;age&quot; value=&quot;<? echo(&quot;$age&quot;)?>&quot;> </p> <p> <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;> </p> </form> <p>&nbsp;</p> </body> </html>
  • 8. update.php <? // script to display all the records in a table // connection information $hostName = &quot;dbm1.itc.virginia.edu&quot;; $userName = “user&quot;; $password = “password&quot;; $dbName = “dbname&quot;; // make connection to database mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;); // Select all the fields in all the records of table1 $query = &quot;UPDATE table1 SET name = '$name', age = '$age' WHERE ID = '$ID'&quot;; $result = mysql_query($query); // Close the database connection mysql_close(); header(&quot;Location: display.php&quot;); ?>
  • 9. delete.php <? // script to display all the records in a table // connection information $hostName = &quot;dbm1.itc.virginia.edu&quot;; $userName = “user&quot;; $password = “password&quot;; $dbName = “dbname&quot;; // make connection to database mysql_connect($hostName, $userName, $password) or die( &quot;Unable to connect to host $hostName&quot;); mysql_select_db($dbName) or die(&quot;Unable to select database $dbName&quot;); // Select all the fields in all the records of table1 $query = &quot;DELETE FROM table1 WHERE ID = '$ID'&quot;; $result = mysql_query($query); // Close the database connection mysql_close(); header(&quot;Location: display.php&quot;); ?>