insert update delete view and search data from database in php mysql connection part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends in this video I'm going to show you PHP MySQL I database operations I will cover everything when you are going to crack an interview then this will very helpful for you so I'm going to show you how we can make best database Donelson using PHP and MySQL I and also we are going to use bootstrap so you can easily understand actually what they are going to ask in interview and how we can you result to them so they can select you so first of all you need this Sam without them you cannot use MySQL so first of all you need to install this them then you need to start these two services yeah and then you need one editor so I have one this editor you can use any editor right now we are going to use your notepad plus plus and also we are going to use bootstrap also so we are going to use this notepad now I am going to save as we need to save inside words M folder so J Drive the same and inside them you need to select the set T dots folder I'm going to create one folder here PHP underscore Trinette son and now inside that I'm going to do name index dot PHP so you can see now we have these index dot PHP file is ready now I am going to run and I'm when we check the path is okay or not yeah here in last we don't need to write an get dot php' because it is the default file that's why now we need to create database so for that I am going to upon local host PHP myadmin this is the MySQL here in databases yeah here we need to write our database name so I am going to write database name PHP underscore connection and then create yeah now here I am going to create one table table name is Table one and we are going to take five field I will cover everything so no worry about it here I am going to take one pill id integer then five here primary key and auto increment here first name we are here then email in there contact yeah now I'm going to say so you can see now we have one table with this pie filled and ID's auto-increment yeah now we need we are going to use bootstrap also so we need some pile of bootstrap so for that just open google and write bootstrap form so we'll get any link of this w3 school just open it yeah we are going to use this type of form means first heading and then dead spots so here this is the example sort just open tried forms you can open any example because we are going to collect this from this HTML to body I am going to copy these tests there's less body and then it's less HTML now say and in between inside body we need this container and this form yeah copy and now you are going to just yeah now just I'm going to run here and you can see we have this form you can see these foam width is very high but we don't want this type of bit poem we want little bit little bit little sway here I can write like this division class call LG for and complete here yeah so this is a poem but right now you can see we want first name last name email encode contact so Edward into it we are going to change the heading first of all in formats and we are going to make this empty then name you can give any name in here we need to do meth or pasta yeah this is good now here IDs auto increment so we don't need to take this first name last name here input type text first name here ID last name yeah first name last name then I'm going to copy this for email here email yeah email now we don't need these jet boat so I am going to delete this now I'm going to copy and paste contact yeah so now I am going to check here you can see we go to your first name last name email and contact and we are going to change this heading yeah so we got this now we are going to change the heading of the submit button so for that here in shut yeah now here update going to change your name insert we need to give unique name to all button that's why delete here we need to you update and here Delta yeah yeah and display we will display directly so when you are going to insert the record we will display the directly but before that we are going to start this or insert operation so now for that we need some part to display our record also so I am going to copy this past year ends less div here we are going to display our record I just made part yeah but later on no worry about so cut this yeah so now after this body or anywhere you can write your PHP code so I just got PHP code here I am going to write if he said the underscore post and our first button is insert so I am going to write like this when you are going to do this type of event on that time after writing this code just write eco and write something for testing because sometimes what happen I am going to check this you can see I just press insert button I got testing some time what happen if you are missing something to write here or did any mistake or button naming thread then what happened your this event was not worked and you are going to find your error anywhere else that's why I just check it that you are getting this message if you are getting this message then this is okay now if you are getting any problem then problem is between these two curly back at only not anywhere else that's why okay now as a professional when you are going to do any database connectivity you need to three at one connection file so I'm going to create new file I am going to save this file connection dot PHP inside my same folder and inside these you need to write boiler link is equal to - PLI and the score Carnot localhost and here root localhost is your server name root is your user name and third parameter is empty because right now we don't have any password that's why and here we need your database name or database name is PHP in the score current son yeah good and here you need to write or die so if you are getting any problem so this die will give you proper message that's why this is a one trade one kind of trycatch yeah just copy this and paste here also yeah now I'm going to include that file here include connection dot PHP yeah and this ol bootstrap files that you need to include yeah which we've already included here ok so directly now we need to write here mysql i underscore query builder link and here we can write insert into for table name is table one and we'll use and here we need to pass fie parameter first one is ID that is the Ottoman that's why we need to pass like this null and five then we need to pass all the parameter inside single records here so first first name last name email encanta this is the name of our tips boxes that we need to pass here so I am going to pass here first name last name email and here we need to pass contact yeah perfect now now we are going to take I am going to write here my name my email and my contact and insert oh yeah here we need to write input type test yeah and insert yeah now I am going to change here browse India you can see we got record inside our MySQL database our MySQL table but now that inserted record we want to display here in below here so for that here we need to display our record but for that we are going to take bootstrap table so here we can see put script tables there are lots of format we are going to date this permit so try it yourself directly we can take this table up to this less table this is very easy same is our HTML table table only the difference is just given this name and this is the heading and I am going to delete this yeah we are going to change first name last email and one more heading end that is yeah we are going to display D also so for ID we can write like this T it yeah and now here we need to do a database connectivity so for that here we are going to move or loop then build our es is equal to MySQL I and the scores query $10 link here select star from table one yeah then while loop while dollar Rho is equal to my school I and the score th underscore array then dollar are years now here we can write equal TR equals less dear equal to D equals less Tilly and in between year equal to R or field name ID then first name last name email and contact so this is the table that we can see start from here and end here so now refresh here and you can see we got record yeah this is the by mistake so yeah so you can see we got here our record now we are going to perform here I will show you update operation how we can perform from here delete operation premier and then art I am going to show you how we can add edit and delete button button here after this context this is the professional way but we per that I will show you how we can update record like you can see first I will show you delete when I am going to write my name on me and going to press this delete button we are going to record that we are going to delete the record whose name is a myth so for that here we need to write if he said to underscore post I am going to write here delete and then we need to write here delete query so maestria lie yeah this is the our button name don't forget this is not name this is known as well use this is the name link here delete from table 1 where name is equal to dollar underscore post past me yeah now yet I'm doing Oh syntax mistake yeah oh great what is not deleted why let me check yeah we're first name is equal to yeah so we can write here also this way or die my still i underscore error builder link so now next time when you are getting any error it will show you proper error am it end date you can see the record is deleted now we are going to perform update operation copy paste here update here I'm going to write update table one say it first name is equal to do underscore post last name yeah everyone did mistake here just consider I just passed the reference of say 20 experts because our second gets much name is last name that so I just passed the reference between wit means not that I pass your last name it means these steps bus is reserved for last name nothing like this this is only for reference whatever written in this last name dead spots it will pass here okay I will show you I am going to write here one more record insert and I am going to replace this page we can see we got here now I am going to write here Romney it is and amid to now update and I'm going to repress this page you can see this first name is updated so this way we can update the retro India agency after insert I need Plus this page manually so if you don't want to you i refresh this page manually just like right like this complete the PHP start the PHP between there dry script type text/javascript slave stripped and window dot location dot href is equal to window root locus and dot H are you just I'm going to copy this and going to paste everywhere here and here also now I am going to write one more record and go into insert and we can see we go directly here so what happen after inserting the operation it will repress the page yeah now here I am going to give you two button one is edit button and one is delete button so for that here I'm going to add two heading yeah I did delete here also we need yeah now here I am going to complete PHP and start PHP because I am going to add here button that's why so button type 'button slashed button class BT and BT and success and here I am going to write edit yeah now let me check yeah we got here oh yeah this is your tree just copy paste here danger it means red color and delete yeah now we need to give your href tete a href complete the a here a drain href complete a here we can give our page name edit but PHP and we are going to pass ID from here ID is equal to this is the professional way dollar yd here delete dot PHP ID is equal to then and then we can get idea actually on which record you click on edit or delete you can see just yet here when I move Mouse just check here you can see I move mouse on edit you can see ID is equal to get I is equal to 3 0 so ID is equal to 3 90 is equal to 2 so now when I am going to click on delete you can see this delete page will open and on then page we will get ID is equal to 2 so what we are going to do in this page we are going to get this ID and then we are going to pass delete we're inside this so first of all we need to create that page so I am going to create that page yeah now include Trinette Sun dot PHP now I am going to it yet ID don't disclose yet ID then mysqli and the squat query color link then delete from table 1 where ID is equal to dollar writing after performing this oppression we need to use JavaScript to go back 1 over index dot PHP so script type text layers JavaScript slash 310 window dirt latias on is equal to index dot PHP yeah so now here we are going to check I'm going to click on this red curve and you can see there that what is deleted yeah so now we are going to perform this way edit oppression so for that also we need to create new page file new file save as edit dot PHP so for this edit dot PHP I'm going to copy this in debts paid code all the code I am going to paste here then you edit dot PHP right now we don't need this so I am going to delete these this table also don't require so I am going to delete that also and here only we need these Update button yeah perfect now I'm going to click on this edit and you can see here we go to edit dot PHP with this design yeah we don't want these ok but now what we have to do actually when you click on any record on ad don't that time we need to peel that right word here we want your first name last name email in contact we want to fill that record so for that he had yet that record dollar and easy to do no score yet ID yeah then dollar re s is equal to MySQL i underscore query the link and here we need to write select query so select star from table 1 where ID is equal to dollar ID yeah then while loop yeah and here we are going to declare the Lord first name your last name your email and dollar contact and we are going to save on that littler variable first name is equal to dollar row first name this is known as our table column name database table now here last name email and here contact last name email and here we need to you contact now this value we need to fill inside the steps but so we need to write here a value then it coded or first-name now we are going to copy this value copy a million contact yeah now I'm going to show you you can see we go at record here just I click on this edit and you can see we go to your record now we need to perform update operation so for that which into your update operation if he said don't ask your post and here we need to pass update and here we need to pass update queries of my still i underscore three erry dollah link update first name is equal to last name is equal to email is equal to contact is equal to where ID is equal to dollar ID now here we are going to write del underscore post first name underscore post last name underscore post email and here the underscore post contact yeah after the subject oppressor and we need to go back on our index page so again we need to write here script type text/javascript here window dot location is equal to index dot PHP yeah so now here you can see I am going to write here too I changed my contact number just and just click Update button so it is not edited let's see no something missed it so we are going to check what is the problem update table 1 and set yeah now we have to end it dubbed it and you can see the record is updated so this way we can perform this basic database operation with all functionalities we can see insert update delete this is the display all the functionalities yeah and in part two I will show you how we can add image also a year now you can add image because sometimes they ask that please add image here so how we can add image that I will show you in this part two video thank you so much for watching my video if you like my video then please like it and share it thank you so much I drink
Info
Channel: Amit Andipara
Views: 65,400
Rating: undefined out of 5
Keywords: php mysql example, mysql connect to database, insert update delete in php mysql, database operations in php, insert select update delete, insert update delete view and search data from database in php, Select Insert Update Delete In Php MySQL Example, Update and Search Data in MySQL using php, Insert View Edit and Delete Record from Database Using PHP, php mysqli tutorials, php tutorial, mysql, insert update delete in php, insert update delete in php mysql in hindi, php
Id: 6y6e5gHAtbo
Channel Id: undefined
Length: 32min 38sec (1958 seconds)
Published: Mon Sep 16 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.