1 / 3

PHP CRUD operation/finction

PHP CRUD operation is create,read,updateand delete that means create(i.e insert the records),read(i.e retrieve the records),update(i.e update the existing records) and delete(i.e delete the existing records).CRUD operations are a data manipulation for database.

Phptpoint
Download Presentation

PHP CRUD operation/finction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP CRUD Tutorial PHP is known as the finest web development language in all of the present languages. PHP is meant for the designing and development of the website. There are various operations in the PHP that leads to the creation of a beautiful website that is responsive and fast enough as compared to the other platforms websites. There is an operation in the PHP language that is known as CRUD that basically elaborates to Create, Read, Update, and Delete. The main operations that are involved in these CRUD operation in PHP are: modification (update), creation (insertion), deletion, and retrieving. Let’s Understand What is CRUD? CRUD operation in PHP is a combined name that has been basically known to contain for major types of Database operations that are: Create, Read, Update, and Delete. Whether you are doing any project, majority of the applications will have the execution of some kind of CRUD application in PHP. It will be very easy for any programmer to use these CRUD operations in various projects, when they will get a hold of it. For instance, if a programmer starts to learn the making of the student table with multiple columns then the same approach can be used to create an employee table or a customer’s table. Simple CRUD Script The CRUD Script generally contains the minimum number of functions that are required in order to make it accessible to everyone and everyone can understand the code easily. There is a disclaimer about this script that it generally does not include data validation and does not ensure the security.

  2. Hence, it is recommended to every programmer that for their personal use, please make sure to validate the user data. Process of running a CRUD Script Running a CRUD file requires running of the code files and database at the programmer’s server. After the database setup on most local server is done then it is ready to run. After all this there is a requirement of few configuration changes on remote/live server. Here is the list of steps that are required to run a CRUD Script: •The first step involves the downloading of CRUD Script Zip file and extracting it. •Second step is to copy complete crud folder into your local server (in htdocs or www) •Then there is a need to create a new database “crud_db”. •After the creation of the database there is a need to import the database.sql file from the crud folder into database “crud_db” •After performing all these steps, the programmer should run files from crud folder using their server/folder path (For example: http://localhost/crud/) •And you are done! Performing these steps will ensure that it should work properly. After running this, the programmer can add some user data. Then you can perform the operations and run the tests Edit/Update/Delete-User functions as well. Here is a brief description of all the functions that are being used in the CRUD operations in PHP: •config.php : This file is generally used to store the information about the database host, username and password. Please note that most of the local server generally works with the details that have been feed. These details can be changed by the user as per their host and database details. •database.sql: This is basically a database file. The programmers can create a database just after downloading the crud script. There are two types of methods that are used for a database either the programmer can run commands from mysql file or simply import a database file name ‘database.sql’ file into the database.

  3. •index.php: This file is generally known as the main file that includes the configuration file for a database connection. After this it display the entire users list using MySQL Select Query. However, if the programmer feels the need to add some users then he can do that by clicking on the ‘Add New User’ link. •add.php: This file is basically responsible for the insertion of the new users. In order to capture the user data, HTML form is generally used in CURD. MySQL INSERT Query is the one that is responsible to insert the user data into database after the submission of the user data. A programmer can view the added user by clicking on the “View User” button. •edit.php: This function is basically used to edit/update the user data after a user click on ’Edit’ link. It generally fetches the user’s current data in the form. The programmer can change the user’s data and update the same after doing so, it will redirect to the homepage after ensuring the update successfully. •delete.php: This function file is generally called when the programmer click on the ‘Delete’ link for any of the existing user. Doing this will delete the selected user. Delete/edit/update operations basically use the specific user_id in order to identify the users. Some Common Mistakes while running the CRUD Script •To ensure the proper functioning of the CRUD in PHP please make sure that all the files have been properly downloaded and extracted. •The database that has been created should be of the same name as mentioned in config.php. •The very important point is to make sure that the folder name is right, when running the CRUD script. At various times it is possible that there are folders inside folders. The programmer should adjust their path or folder accordingly. To learn more about CRUD in PHP read our PHP CRUD tutorial or more topics of this type, you can log onto our PHP tutorial and start your learning now! If you are interested to learn HTML then visit here - HTML Tutorial Point - Learn Beginners and Professionals Original Source

More Related