Skip to main content

How To Insert, Update, Delete Record on Mysql Database In PHP

 


1.Insert Query

$sql = "INSERT INTO persons (first_name, last_name, email) VALUES           ('Peter', 'Parker', 'peterparker@mail.com')";

if(mysqli_query($link, $sql)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }

3.Update Query

$sql = "UPDATE persons SET email='peterparker_new@mail.com' WHERE id=1"; if(mysqli_query($link, $sql)){ echo "Records were updated successfully."; } else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }

3.Delete Query

$sql = "DELETE FROM persons WHERE first_name='John'"; if(mysqli_query($link, $sql)){ echo "Records were deleted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }



* ADVANTAGES OF DATABASE MANAGEMENT SYSTEM  *


2.    Sharing data  :

A database allows the  sharing of data under  its control by any number of application programs or users

3.    Consistency of  data  :

The reduced data redundancy minimizes the presence of the same data in different files which will lead to consistency of data .

4.    Flexibility of  file  system  :

In a database approach, the database is designed based on bottom up approach which ensures that the end users have all the reports. As and when some changes in reports requirements occur. Corresponding revision of the database can be done with minor changes in the database.

5.     Better Enforcement of standards  :

Since different files of the database are designed at a time, there will be better enforcement of standards in terms of defining filed names, filed width, filed type etc. 


Comments

Popular posts from this blog

How To Declare Variable and hello word in php ?

    Hii Guys Today We are Talking about of php variable Declaration and sinple print message and calculate simple sum of two numbers. php is very powerfull language to compare other language. so. lests start and see full tutorial. 1.0 Start PHP           * PHP code always start <?php word throw start and close php code ?> keyword. the following                          syntax throw start php working.                         ------------------------------------------------------------------------------                        |              <?php // start php                                   ...

Learn Python How To install Python ?

  * Traditional File System   : The information system can be either a conventional file processing or a database system. file is a collection of related information with name assigned to it. File processing is the first attempt to computerize the manual system. file can be organized using folders. File system considered as a very primitive kind of   database management system as it allows us to store the data. Data in most organization is stored in the form of files and folders. For example list of student can be stored in a text file or in a spreadsheet. In convention file processing system, each and very subsystem of the information system will have its own set of files. As a result, there will be duplication of data between various     subsystem   of the     information system. For example , a file folder in   office of school   clert might contain student data organized as one file folder for each standard , which is turn will h...

What Is Java How to start Java programming ??

-> there are following feature are required to learn java. * Basic introduction of mysql database. DBMS     (DATABASE  MANAGEMENT  SYSTEM)   : The conventional file processing system had many drawbacks. Hence, an alternate system,   i.e.   database system, which was based on database approach, was desired because it would eliminate all the drawbacks of conventional file processing system. To define the database system   following terms are required:          FILE          DATABASE          DATABASE MANAGEMENT SYSTEM     File is a two dimensional table summarizing the multiple instances of asset of field of an entity. Database is a collection of interrelated data files, while database management system is a computer program that allows storing, organizing and accessing a collection...