SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Ex. No.3                     DATABASE CONNECTIVITY - PHP
28.01.2011

AIM:
       To write PHP script for connecting to database and perform insert, update, delete and select
operations.

DESCRIPTION:
Create a Connection to a MySQL Database:
      The mysql_connect() function is used to establish a connection to the database. The syntax
is:
      mysql_connect(servername,username,password);
where
      servername Optional. Specifies the server to connect to. Default value is "localhost:3306"
      username      Optional. Specifies the username to log in with. Default value is the name of
                    the user that owns the server process
      password      Optional. Specifies the password to log in with. Default is ""

Create a database:
        A database holds one or multiple tables. The CREATE DATABASE statement is used to
create a database in MySQL. The syntax is:
               CREATE DATABASE database_name

Create a Table:
      The CREATE TABLE statement is used to create a table in MySQL. The syntax is:
             CREATE TABLE table_name
             (
             column_name1 data_type,
             column_name2 data_type,
             column_name3 data_type,
             ....
             )

Insert Data Into a Database Table:
       The INSERT INTO statement is used to insert new records in a table. It is possible to write
the INSERT INTO statement in two forms:
       INSERT INTO table_name VALUES (value1, value2, value3,...)
                             (or)
       INSERT INTO table_name (column1, column2, column3,...)
       VALUES (value1, value2, value3,...)
Update Data In a Database:
      The UPDATE statement is used to update existing records in a table. The syntax is:
             UPDATE table_name SET column1=value, column2=value2,...
             WHERE some_column=some_value

Delete Data In a Database:
       The DELETE FROM statement is used to delete records from a database table. The syntax is:
              DELETE FROM table_name WHERE some_column = some_value

Select Data From a Database Table:
       The SELECT statement is used to select data from a database. The syntax is:
              SELECT column_name(s) FROM table_name

SOURCE CODE:

insertform.html:
      <html>
      <head>
        <link rel="stylesheet" type="text/css" href="mystyle.css"/>
      </head>
      <body>
        <pre>
        <h3>STUDENT INFORMATION SYSTEM</h3>
        <form name="myForm" action="insert.php" method="post">
        <table>
        <tr><td>Name</td><td><input type="text" name="name"></td></tr>
        <tr><td>Reg. No.</td><td><input type="text" name="reg"></td></tr>
        <tr><td>Age</td><td><input type=text name="age" size=2/></td></tr>
        <tr><td>Gender</td><td><input type="text" name="gender"</td></tr>
        <tr><td>Email</td><td><input type=text name="email"/></td></tr>
        <tr><td><b>Academic Details</b></td></tr>
        <tr><td>Semester 1 GPA</td><td><input type=text name="sem1"></td></tr>
        <tr><td>Semester 2 GPA</td><td><input type=text name="sem2"></td></tr>
        <tr><td>CGPA</td><td><input type=text name="cgpa"></td></tr></table>
        <center><input type="submit" value="Submit"/>               <input type="reset"
        value="Clear"/>
        </form>
      </body>
      </html>
insert.php:
        <?php
        $con = mysql_connect("localhost","root","");
        if (!$con)
        {
                die('Could not connect: ' . mysql_error());
        }
        mysql_select_db("student", $con);
        $sql= "insert into stud (Name,Regno,Age,Gender,Email,Sem1,Sem2,Cgpa)
                values('$_POST[name]',$_POST[reg],$_POST[age],'$_POST[gender]',
                '$_POST[email]',$_POST[sem1],$_POST[sem2],$_POST[cgpa])";;
        if (!mysql_query($sql,$con))
        {
                die('Error: ' . mysql_error());
        }
        echo "1 record added";
        mysql_close($con)
        ?>

updateform.html:
       <html>
       <head>
              <link rel="stylesheet" type="text/css" href="mystyle.css"/>
       </head>
       <body>
        <pre>
        <h3>STUDENT INFORMATION SYSTEM</h3>
        <form name="myForm" action="update.php" method="post">
        <table>
        <tr><td>Field to update</td><td><input type="text" name="field"></td></tr>
        <tr><td>Value</td><td><input type=text name="new"/></td></tr>
        <tr><td>where</td></tr>
        <tr><td>Field name</td><td><input type=text name="where"/></td></tr>
        <tr><td>value equals</td></tr>
        <tr><td>Value</td><td><input type="text" name="old"></td></tr>
        </table>
        <center><input type="submit" value="Update"/>             <input type="reset"
         value="Clear"/>
        </form>
       </body>
       </html>
update.php:
       <?php
       $con = mysql_connect("localhost","root","");
       if (!$con)
       {
               die('Could not connect: ' . mysql_error());
       }
       mysql_select_db("student", $con);
       $sql="UPDATE stud SET $_POST[field] = '$_POST[new]' WHERE $_POST[where]=
             '$_POST[old]' ";
       if (!mysql_query($sql,$con))
       {
               die('Error: ' . mysql_error());
       }
       echo "1 record updated";
       mysql_close($con);
       ?>

deleteform.html:
        <html>
        <head>
               <link rel="stylesheet" type="text/css" href="mystyle.css"/>
        </head>
        <body>
         <pre>
         <h3>STUDENT INFORMATION SYSTEM</h3>
         <form name="myForm" action="delete.php" method="post">
         <table>
         <tr><td>Name</td><td><input type="text" name="name"></td></tr>
         <tr><td>Regno</td><td><input type=text name="reg"/></td></tr>
         </table>
         <center><input type="submit" value="Delete"/>             <input type="reset"
          value="Clear"/>
          </form>
        </body>
        </html>
delete.php:
        <?php
        $con = mysql_connect("localhost","root","");
        if (!$con)
        {
                 die('Could not connect: ' . mysql_error());
        }
        mysql_select_db("student", $con);
        $sql="DELETE FROM stud WHERE Name='$_POST[name]' and Regno=$_POST[reg]";
        if (!mysql_query($sql,$con))
        {
                die('Error: ' . mysql_error());
        }
        echo "1 record deleted";
        mysql_close($con);
        ?>

select.php:
        <?php
        $con = mysql_connect("localhost","root","");
        if (!$con)
        {
                die('Could not connect: ' . mysql_error());
        }
        mysql_select_db("student", $con);
        $result = mysql_query("SELECT * FROM stud");
        echo "<center>";
        echo "<table border=1>";
        echo "<tr><th>Name</th><th>Regno</th><th>CGPA</th></tr>";
        echo "<br/> <br/>";
        while($row = mysql_fetch_array($result))
        {
                echo "<tr> <td>".$row['Name']. "</td><td>".$row['Regno']. "</td><td>".
                      $row['Cgpa']. "</td></tr>";
                echo "<br />";
        }
        echo "</table>";
        echo "</center>";
        mysql_close($con);
        ?>
operation.html:
       <html>
       <body bgcolor="pink">
              <b>
              Select operation.</b><br><br>
              <a href="select.php" target="main">Select</a><br>
              <a href="insert form.html" target="main">Insert</a><br>
              <a href="update form.html" target="main">Update</a><br>
              <a href="delete form.html" target="main">Delete</a><br>
       </body>
       </html>

frame.html:
       <html>
                 <frameset cols="20,80">
                        <frame src="operation.html" name="op">
                        <frame src="select1.php" name="main">
                 </frameset>
          </html>

OUTPUT:

Select:
Insert:
Update:
Delete:




RESULT:
       Thus PHP scripts are executed to perform insert, update, delete and select operations in a
database.

Weitere ähnliche Inhalte

Was ist angesagt?

MS SQL Database basic
MS SQL Database basicMS SQL Database basic
MS SQL Database basicwali1195189
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF Luc Bors
 
Everything About PowerShell
Everything About PowerShellEverything About PowerShell
Everything About PowerShellGaetano Causio
 
PHP tips and tricks
PHP tips and tricks PHP tips and tricks
PHP tips and tricks Damien Seguy
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V  Advanced PHP and MySQLFYBSC IT Web Programming Unit V  Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQLArti Parab Academics
 
Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Sanchit Raut
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsPierre MARTIN
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHPmarkstory
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologyDaniel Knell
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency InjectionRifat Nabi
 
Topological indices (t is) of the graphs to seek qsar models of proteins com...
Topological indices (t is) of the graphs  to seek qsar models of proteins com...Topological indices (t is) of the graphs  to seek qsar models of proteins com...
Topological indices (t is) of the graphs to seek qsar models of proteins com...Jitendra Kumar Gupta
 
Creating a database
Creating a databaseCreating a database
Creating a databaseRahul Gupta
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 

Was ist angesagt? (20)

MS SQL Database basic
MS SQL Database basicMS SQL Database basic
MS SQL Database basic
 
Php (1)
Php (1)Php (1)
Php (1)
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
Everything About PowerShell
Everything About PowerShellEverything About PowerShell
Everything About PowerShell
 
Agile database access with CakePHP 3
Agile database access with CakePHP 3Agile database access with CakePHP 3
Agile database access with CakePHP 3
 
PHP tips and tricks
PHP tips and tricks PHP tips and tricks
PHP tips and tricks
 
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
FYBSC IT Web Programming Unit V  Advanced PHP and MySQLFYBSC IT Web Programming Unit V  Advanced PHP and MySQL
FYBSC IT Web Programming Unit V Advanced PHP and MySQL
 
Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHP
 
Emmet cheat-sheet
Emmet cheat-sheetEmmet cheat-sheet
Emmet cheat-sheet
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Topological indices (t is) of the graphs to seek qsar models of proteins com...
Topological indices (t is) of the graphs  to seek qsar models of proteins com...Topological indices (t is) of the graphs  to seek qsar models of proteins com...
Topological indices (t is) of the graphs to seek qsar models of proteins com...
 
Creating a database
Creating a databaseCreating a database
Creating a database
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 

Andere mochten auch (8)

Introduction to php database connectivity
Introduction to php  database connectivityIntroduction to php  database connectivity
Introduction to php database connectivity
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
6 3 tier architecture php
6 3 tier architecture php6 3 tier architecture php
6 3 tier architecture php
 
Ajax for PHP Developers
Ajax for PHP DevelopersAjax for PHP Developers
Ajax for PHP Developers
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
 

Ähnlich wie Ex[1].3 php db connectivity

Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operationsyeda zoya mehdi
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2ADARSH BHATT
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageLovely Professional University
 
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering CollegeDatabase Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering CollegeDhivyaa C.R
 
8. Php MongoDB stergerea unui document
8. Php MongoDB stergerea unui document8. Php MongoDB stergerea unui document
8. Php MongoDB stergerea unui documentRazvan Raducanu, PhD
 
Latihan form login
Latihan form loginLatihan form login
Latihan form loginEdy Sinaga
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programsSULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programsSULTHAN BASHA
 
Practical PHP by example Jan Leth-Kjaer
Practical PHP by example   Jan Leth-KjaerPractical PHP by example   Jan Leth-Kjaer
Practical PHP by example Jan Leth-KjaerCOMMON Europe
 
Module 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docx
Module 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docxModule 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docx
Module 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docxmoirarandell
 
Ôn tập KTTMDT
Ôn tập KTTMDTÔn tập KTTMDT
Ôn tập KTTMDTmrcoffee282
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From IusethisMarcus Ramberg
 

Ähnlich wie Ex[1].3 php db connectivity (20)

Update statement in PHP
Update statement in PHPUpdate statement in PHP
Update statement in PHP
 
Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operation
 
Delete statement in PHP
Delete statement in PHPDelete statement in PHP
Delete statement in PHP
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
Phpfunction
PhpfunctionPhpfunction
Phpfunction
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup languageThe HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
 
UNIT V (5).pptx
UNIT V (5).pptxUNIT V (5).pptx
UNIT V (5).pptx
 
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering CollegeDatabase Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
Database Connectivity MYSQL by Dr.C.R.Dhivyaa Kongu Engineering College
 
Php
PhpPhp
Php
 
Php summary
Php summaryPhp summary
Php summary
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
8. Php MongoDB stergerea unui document
8. Php MongoDB stergerea unui document8. Php MongoDB stergerea unui document
8. Php MongoDB stergerea unui document
 
Latihan form login
Latihan form loginLatihan form login
Latihan form login
 
SULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programsSULTHAN's - PHP MySQL programs
SULTHAN's - PHP MySQL programs
 
Practical PHP by example Jan Leth-Kjaer
Practical PHP by example   Jan Leth-KjaerPractical PHP by example   Jan Leth-Kjaer
Practical PHP by example Jan Leth-Kjaer
 
Module 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docx
Module 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docxModule 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docx
Module 6WEB SERVER AND SERVER SIDE SCRPTING, PART-2Chapte.docx
 
Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
Ôn tập KTTMDT
Ôn tập KTTMDTÔn tập KTTMDT
Ôn tập KTTMDT
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 

Ex[1].3 php db connectivity

  • 1. Ex. No.3 DATABASE CONNECTIVITY - PHP 28.01.2011 AIM: To write PHP script for connecting to database and perform insert, update, delete and select operations. DESCRIPTION: Create a Connection to a MySQL Database: The mysql_connect() function is used to establish a connection to the database. The syntax is: mysql_connect(servername,username,password); where servername Optional. Specifies the server to connect to. Default value is "localhost:3306" username Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process password Optional. Specifies the password to log in with. Default is "" Create a database: A database holds one or multiple tables. The CREATE DATABASE statement is used to create a database in MySQL. The syntax is: CREATE DATABASE database_name Create a Table: The CREATE TABLE statement is used to create a table in MySQL. The syntax is: CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, .... ) Insert Data Into a Database Table: The INSERT INTO statement is used to insert new records in a table. It is possible to write the INSERT INTO statement in two forms: INSERT INTO table_name VALUES (value1, value2, value3,...) (or) INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
  • 2. Update Data In a Database: The UPDATE statement is used to update existing records in a table. The syntax is: UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Delete Data In a Database: The DELETE FROM statement is used to delete records from a database table. The syntax is: DELETE FROM table_name WHERE some_column = some_value Select Data From a Database Table: The SELECT statement is used to select data from a database. The syntax is: SELECT column_name(s) FROM table_name SOURCE CODE: insertform.html: <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"/> </head> <body> <pre> <h3>STUDENT INFORMATION SYSTEM</h3> <form name="myForm" action="insert.php" method="post"> <table> <tr><td>Name</td><td><input type="text" name="name"></td></tr> <tr><td>Reg. No.</td><td><input type="text" name="reg"></td></tr> <tr><td>Age</td><td><input type=text name="age" size=2/></td></tr> <tr><td>Gender</td><td><input type="text" name="gender"</td></tr> <tr><td>Email</td><td><input type=text name="email"/></td></tr> <tr><td><b>Academic Details</b></td></tr> <tr><td>Semester 1 GPA</td><td><input type=text name="sem1"></td></tr> <tr><td>Semester 2 GPA</td><td><input type=text name="sem2"></td></tr> <tr><td>CGPA</td><td><input type=text name="cgpa"></td></tr></table> <center><input type="submit" value="Submit"/> <input type="reset" value="Clear"/> </form> </body> </html>
  • 3. insert.php: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("student", $con); $sql= "insert into stud (Name,Regno,Age,Gender,Email,Sem1,Sem2,Cgpa) values('$_POST[name]',$_POST[reg],$_POST[age],'$_POST[gender]', '$_POST[email]',$_POST[sem1],$_POST[sem2],$_POST[cgpa])";; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> updateform.html: <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"/> </head> <body> <pre> <h3>STUDENT INFORMATION SYSTEM</h3> <form name="myForm" action="update.php" method="post"> <table> <tr><td>Field to update</td><td><input type="text" name="field"></td></tr> <tr><td>Value</td><td><input type=text name="new"/></td></tr> <tr><td>where</td></tr> <tr><td>Field name</td><td><input type=text name="where"/></td></tr> <tr><td>value equals</td></tr> <tr><td>Value</td><td><input type="text" name="old"></td></tr> </table> <center><input type="submit" value="Update"/> <input type="reset" value="Clear"/> </form> </body> </html>
  • 4. update.php: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("student", $con); $sql="UPDATE stud SET $_POST[field] = '$_POST[new]' WHERE $_POST[where]= '$_POST[old]' "; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record updated"; mysql_close($con); ?> deleteform.html: <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"/> </head> <body> <pre> <h3>STUDENT INFORMATION SYSTEM</h3> <form name="myForm" action="delete.php" method="post"> <table> <tr><td>Name</td><td><input type="text" name="name"></td></tr> <tr><td>Regno</td><td><input type=text name="reg"/></td></tr> </table> <center><input type="submit" value="Delete"/> <input type="reset" value="Clear"/> </form> </body> </html>
  • 5. delete.php: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("student", $con); $sql="DELETE FROM stud WHERE Name='$_POST[name]' and Regno=$_POST[reg]"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record deleted"; mysql_close($con); ?> select.php: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("student", $con); $result = mysql_query("SELECT * FROM stud"); echo "<center>"; echo "<table border=1>"; echo "<tr><th>Name</th><th>Regno</th><th>CGPA</th></tr>"; echo "<br/> <br/>"; while($row = mysql_fetch_array($result)) { echo "<tr> <td>".$row['Name']. "</td><td>".$row['Regno']. "</td><td>". $row['Cgpa']. "</td></tr>"; echo "<br />"; } echo "</table>"; echo "</center>"; mysql_close($con); ?>
  • 6. operation.html: <html> <body bgcolor="pink"> <b> Select operation.</b><br><br> <a href="select.php" target="main">Select</a><br> <a href="insert form.html" target="main">Insert</a><br> <a href="update form.html" target="main">Update</a><br> <a href="delete form.html" target="main">Delete</a><br> </body> </html> frame.html: <html> <frameset cols="20,80"> <frame src="operation.html" name="op"> <frame src="select1.php" name="main"> </frameset> </html> OUTPUT: Select:
  • 9. Delete: RESULT: Thus PHP scripts are executed to perform insert, update, delete and select operations in a database.