Silahkan Melihat Tutorial di website kami dengan nyaman ENJOY YOUR LIFE ☕

PHP :: PHP CRUD with Twitter Bootstrap

PHP CRUD with Twitter Bootstrap Part - 2
We have already created create option in our previous part after adding a record our grid looks like this:
PHP CRUD Main page part 2
Create Read page
Create a page “read.php” and add in your CRUD directory, this file used to give read functionality to you CRUD system.
Above section contains PHP code on top is used to get id of record from query string and pass that id to database and get users information. If id not passed in query string then it will be redirected to “index.php” page and if invalid id passed in that case it will again redirect to “index.php” page.
Passing a valid id to the read page it will fetch data in $data variable and put it in 2nd part of the page which is HTML and make it view able to you.
PHP CRUD Read page
Create Update page
Create a PHP page for update data “update.php”. This is the update part of CRUD system, as we have already created Create file we use the same file to build form and use PHP ofRead form to get data on based of id and make update query.
This code is used to Update a user’s data and its a combined page of Create and Read with the change in query like in create page we used to insert data and here in update page that same query changed to update. Read code of PHP is used to fetch data from table and put in form input fields.
When you post data it will validate data in PHP if data validated successfully the run update query and update your data.
PHP CRUD Update page
Now we have to do final step of PHP CRUD.
Delete Page
Create a page to delete data to do that we have created a file “delete.php” in that file we put below code in our file and add a button in out main page for delete.
The delete page code first of all comes to “delete.php” page and confirm that you want to delete that record with an id in query string. If id not passed in query string then it will be redirected to “index.php” page if id exists it will ask for confirmation with yes and nobuttons if you press yes it will delete record and redirect to “index.php” page if you press no it will redirect to “index.php” page without deleting the record.
PHP CRUD Delete page
Finally our PHP CRUD grid looks like this:
PHP CRUD Main page complete
That’s all for PHP CRUD I hope you enjoyed this tutorial and find it helpful. If you have any question or suggestion please feel free  to comment below. Do share this with your using below social buttons.




0 komentar:

Post a Comment

PHP :: PHP CRUD with Twitter Bootstrap