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                                   ...

Advantage and Disadvantage Of PHP Limitation of PHP

               *  ADVANTAGE OF PHP HIERARCHICAL DATATABLE MODELS * 1. Conceptual Simplicity :  As the information is represented in form of tree structure, it is easy to view, understand, and retrieve the data. This helps the database designer to obtain conceptual clarity of relationship.  2.. Database security :  Security is provided by DBMS. Thus Programming effort is decreased  compared to file system in which programmer has to write the programs for implementing security.  3. Data independence :  If changes are made in design of database, DBMS takes care of cascading it throughout the system. There is no need to make change in system.  * DISADVANTAGE OF PHP HIERARCHICAL DATABASE MODELS  * 1. Complexity :  To implement the database using hierarchical model. programmer needs to have detailed knowledge of how the data is’ stored has to traverse entire tree for the same.  2. Data Redundan...

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...