Update Mysql Data through Bootstrap Modal with PHP Ajax [w/ subs]



00:00:00 – hello friends in this video we are going
00:00:01 – to discuss how can be update data and
00:00:04 – mysql table with bootstrap model by
00:00:07 – using PHP script with ajax query without
00:00:11 – page refresh and previous video tutorial
00:00:14 – on bootstrap model we have so how to
00:00:17 – insert data into mysql table by using
00:00:20 – bootstrap model with PHP script with
00:00:23 – ajax query the main use some bootstrap
00:00:27 – modal we can do any type of database
00:00:29 – operations like insert update and delete
00:00:32 – or display any message without opening
00:00:35 – of new page but we can do this type
00:00:37 – things on page in the form of popular
00:00:40 – box we can call this bootstrap modal by
00:00:44 – click on anchor tag or any button by
00:00:46 – using is query code or you can also sew
00:00:49 – bootstrap modal window by defining data
00:00:51 – attribute an element
00:00:57 – now we have start discussing update of
00:01:00 – mysql data through bootstrap modal this
00:01:04 – is our testing database and in this
00:01:06 – database we have employee table the
00:01:08 – table column like head name address
00:01:11 – gender designation and age and previous
00:01:15 – we have show inserting of data into this
00:01:17 – employee table by using bootstrap modal
00:01:21 – but in this video we will update this
00:01:23 – table data by using bootstrap modal this
00:01:27 – is our index dot PHP page and on this
00:01:30 – page in previous video we have fashion
00:01:32 – employee data in HTML table with two
00:01:35 – columns like employee named view an
00:01:38 – employee name column we have display
00:01:40 – name of employee and in view column we
00:01:42 – have create view button when we have
00:01:44 – click on this view button then we can
00:01:46 – show all information of employee in
00:01:49 – bootstrap modal and above this employee
00:01:52 – table data we have create one Add button
00:01:54 – we can add new employee database by
00:01:57 – clicking on the sad button when we have
00:02:00 – click on the sad button bootstrap model
00:02:02 – with insert data form has been appeared
00:02:04 – with bootstrap modal we can fill that
00:02:07 – form and we can enter employee details
00:02:09 – into employee table through bootstrap
00:02:12 – modal
00:02:14 – now in this video first we have add one
00:02:17 – more column between this two table
00:02:19 – column for edit employee details so
00:02:22 – between this two column we have right
00:02:24 – open and close table head tag with with
00:02:27 – 15 percentage with texts like and it
00:02:31 – in this column we want to display edit
00:02:33 – button for all employee so in while loop
00:02:36 – we have right open and close table data
00:02:39 – tag and between this time we have right
00:02:41 – input type is equal to button with
00:02:43 – attribute name is equal to edit value is
00:02:46 – equal to edit and it is equal to open
00:02:48 – and close PHP tagging between this tag
00:02:51 – we have right alko statement with dollar
00:02:53 – row variable and class is equal to edit
00:02:56 – data this way we have create edit button
00:02:59 – for all employees and here we have store
00:03:02 – employee ID attribute and we will use
00:03:04 – this class attribute edit data and
00:03:07 – square e cold a selector and from the
00:03:09 – attribute we will get it of particular
00:03:11 – employee now we have moved to write a
00:03:14 – query code for granted employee your
00:03:16 – data when we have plick on edit button
00:03:19 – and at that time bootstrap model has
00:03:22 – been appeared on webpage with employee
00:03:24 – details inform so for this we have right
00:03:27 – dollar document with on math and this
00:03:30 – method we have right click event with
00:03:32 – selector a data class of edit button
00:03:35 – with function
00:03:47 – under this first we have right variable
00:03:50 – employee is equal to dollar this thought
00:03:52 – attribute method with it
00:03:54 – attribute as argument in this employee
00:03:57 – variable we will store employee would
00:03:59 – get from the attribute by using
00:04:01 – attribute method and here we will get
00:04:03 – particular employee it by using this
00:04:06 – selector
00:04:11 – after getting employee now we want to
00:04:14 – get employee details from this employee
00:04:17 – and display this details under bootstrap
00:04:19 – model with form so here we have defined
00:04:22 – ajax method so we have right dollar ajax
00:04:25 – method and this method first we have
00:04:28 – defined URL option set to fetch dot PHP
00:04:31 – we have said requested to this page
00:04:35 – under this method we have right method
00:04:37 – set to post here we have set post method
00:04:40 – for sending data to the server after
00:04:43 – this which data you want to send to the
00:04:46 – server so here we have right data option
00:04:48 – employee yet here we want to send
00:04:51 – employeer data to the server with ajax
00:04:54 – request after this we have data type the
00:04:57 – jason here we want to receive data from
00:05:00 – server and Jason format
00:05:03 – last and ajax method request we have
00:05:06 – right success callback function when
00:05:08 – request.send successfully than this
00:05:10 – function has been called and in this
00:05:12 – function we will receive data from
00:05:14 – server and function data argument here
00:05:17 – we will data and Jason format from
00:05:19 – server because we have defined Jason
00:05:22 – datatype our ajax request and previous
00:05:26 – video on bootstrap model we have already
00:05:29 – created bootstrap model with a dad data
00:05:32 – model and in modal we have create one
00:05:34 – HTML form for inserting employee data so
00:05:38 – in this model's form we want to display
00:05:40 – particular employee data and form field
00:05:45 – in this ajax request we have received
00:05:48 – data from server and Jason format so for
00:05:51 – displaying employee named under text box
00:05:54 – with names so we have right dollar text
00:05:56 – box that name dot value method and under
00:05:59 – this method we have right data dot name
00:06:01 – here name from data dot name is the
00:06:04 – table column of employee table
00:06:07 – this will display employee named under
00:06:09 – name text box then after we have right
00:06:12 – dollar with tax area in a dress with
00:06:15 – value method and under this method we
00:06:17 – have right data dot address this will
00:06:20 – display address under address text area
00:06:23 – filled and form
00:06:25 – after this we have right dollar with
00:06:27 – select box that gender with value method
00:06:30 – and under this method we have right data
00:06:32 – da gender this will set gender value on
00:06:35 – gender select box filled in form then
00:06:38 – after we have right dollar with tax
00:06:40 – boxhead designation with value method
00:06:43 – and under this method we have right data
00:06:45 – dot designation this will show employee
00:06:48 – designation under designation text box
00:06:51 – filled in form after this we have right
00:06:54 – dollar with tax box and age with value
00:06:56 – method and under this method we have
00:06:58 – right data dot age
00:07:00 – this will display aged under textbox age
00:07:03 – field and form for storing employee had
00:07:06 – informed for update of particular
00:07:09 – employee data so in model form we have
00:07:12 – create one hidden field for storing
00:07:14 – employee yet so here we have right input
00:07:17 – type is equal to hidden with attribute
00:07:20 – name is equal to employees and it is
00:07:22 – equal to employee yet now for storing
00:07:25 – employee into hidden field so we have
00:07:28 – right dollar with him field employee had
00:07:31 – with value method and under this method
00:07:33 – we have right data dotted this will
00:07:35 – store employee it into hidden field but
00:07:38 – named employee and inform now we want to
00:07:41 – change the name of submit button current
00:07:44 – its name his name but when modal appear
00:07:46 – on web with employee data field and form
00:07:49 – field for Rob date data that at times
00:07:52 – submit button name must be update so for
00:07:55 – we have right dollar with button it
00:07:56 – insert dot value method and under this
00:07:59 – method we have defined update this code
00:08:02 – will display update text on submit
00:08:04 – button
00:08:04 – lastly we have right dollar with modal
00:08:07 – it dad data model with modal method with
00:08:10 – show by this code will show bootstrap
00:08:13 – modal on webpage with form element
00:08:15 – filled with filled employee data
00:08:19 – now we have moved to write PHP code for
00:08:22 – fetch particular employee data and fast
00:08:25 – dot PHP page so on this page
00:08:29 – first we have made database connection
00:08:31 – after making database connection we have
00:08:33 – right of statement with conditions like
00:08:35 – set function with arguments like dollar
00:08:38 – post employee variable this condition
00:08:41 – will check value of this variable has
00:08:43 – been set or not if value of this
00:08:46 – variable has been set then it will
00:08:49 – execute if block of code and under this
00:08:51 – block we have right query variable is
00:08:53 – equal to select star from employee table
00:08:56 – where n is equal to dollar post employee
00:08:59 – yet here we have get value of employee
00:09:02 – from ajax request and this query will
00:09:04 – select employee data of this employee
00:09:07 – variable value now we want to execute
00:09:11 – this query so we have right resolve
00:09:13 – variable is equal to miss clay query
00:09:15 – function with two argument in first
00:09:18 – argument we have right database
00:09:20 – connection string which is dollar
00:09:22 – connect variable and then second
00:09:23 – argument we have right dollar query
00:09:25 – variable this function will execute this
00:09:28 – query and store result into this result
00:09:31 – variable
00:09:33 – after this we have right dollar row
00:09:35 – variable is equal to mystically fetch
00:09:38 – array function with arguments like
00:09:39 – dollar resolved variable this function
00:09:42 – will convert query resolved to
00:09:44 – associated moraine store into this
00:09:46 – dollar row variable so we have store
00:09:50 – employee data and thus taller row
00:09:52 – variable and associative ray now we want
00:09:55 – to send this data to Ajax requests and
00:09:58 – Jason format so for we have right Jason
00:10:01 – and code function with arguments dollar
00:10:03 – Rome this function will convert
00:10:05 – associative array to geison string and
00:10:08 – send us converted data to Ajax requests
00:10:11 – and an AJAX request we have already set
00:10:14 – all this data into modal form fields so
00:10:17 – we have saved this code on checkout
00:10:19 – button browser
00:10:23 – friends you can see that when we have
00:10:25 – click on the setup button then bootstrap
00:10:28 – model has been pop on webpage with
00:10:30 – filled form with particular employee
00:10:32 – details here we have also shown submit
00:10:36 – button name has been changed from insert
00:10:38 – the update so when we have click on this
00:10:41 – button then this data has been updated
00:10:44 – in my SQL table
00:10:48 – so for this we have to move right some
00:10:51 – PHP code under insert dot PHP file which
00:10:54 – we have create and previous video for
00:10:56 – inserting employee data under this file
00:10:59 – here we have right of statement with
00:11:01 – conditions like dollar post employee
00:11:04 – variable not equal to blank this code
00:11:06 – will check if employee variable has some
00:11:09 – Diana will execute if block of code but
00:11:12 – if it has no value then it will execute
00:11:14 – tells block of code here employee it is
00:11:17 – the hidden field and form which we have
00:11:20 – ad for storing value of employee it for
00:11:23 – robbed a particular employee your data
00:11:29 – if this employee
00:11:31 – variable has no value that means we want
00:11:33 – to insert some data so it will execute
00:11:36 – cells block and in this block we have
00:11:38 – put insert query which we have already
00:11:40 – created in our previous video but
00:11:43 – suppose employee variable has some value
00:11:46 – that means we have store employee it
00:11:49 – into this hidden employee variable so it
00:11:52 – will execute if block of code and under
00:11:54 – this we want to write query for update
00:11:56 – data so in this block we have right
00:11:59 – query variable is equal to update
00:12:01 – employee table set name is equal to
00:12:03 – dollar name variable address is equal to
00:12:06 – address variable gender is equal to
00:12:09 – dollar gender variable designation
00:12:11 – variable is equal to dollar designation
00:12:14 – variable H is equal to the dollar age
00:12:16 – variable where is equal to dollar post
00:12:19 – employee variable
00:12:22 – so our update query is ready for robbed
00:12:26 – a particular employee data according to
00:12:28 – this dollar employee variable if dollar
00:12:32 – post employee variable has some value
00:12:34 – then it will execute if block of code in
00:12:37 – this block we have created update data
00:12:40 – query and store into dollar query
00:12:42 – variable but if dollar post employee
00:12:44 – variable has no value then it will
00:12:47 – execute tells block of code and under
00:12:49 – this block we have create insert query
00:12:51 – which store into dollar query variable
00:12:55 – now we have create dollar math such
00:12:58 – variable is equal to blank and an F
00:13:00 – block we have right dollar math such
00:13:02 – variable is equal to the data updated an
00:13:05 – else block of code we have right dollar
00:13:07 – math such variable is equal to the data
00:13:09 – inserted message
00:13:12 – below this code which we have already
00:13:14 – created in our previous video for
00:13:16 – execute dollar query variable query and
00:13:19 – after execute query we have fetch data
00:13:21 – from employee table for showing on
00:13:24 – webpage under this code here have
00:13:26 – removed data inserted and write dollar
00:13:29 – math such variable for showing data
00:13:31 – inserted or updated message on web page
00:13:35 – and after thus in this code we want to
00:13:38 – add one more table column for displaying
00:13:40 – edit button under HTML table so here we
00:13:44 – have rights open and close table heading
00:13:46 – tag with tax like ended
00:13:51 – in this column we want to display edit
00:13:53 – button for all employee so in while loop
00:13:56 – we have right open and close table data
00:13:59 – tag and between this time we have right
00:14:01 – input type is equal to button with
00:14:03 – attribute name is equal to edit value is
00:14:06 – equal to a depended is equal to a co
00:14:08 – statement with dollar row variable and
00:14:11 – class is equal to edit data this way we
00:14:14 – have create edit button for all
00:14:16 – employees and here we have store
00:14:18 – employee ID attribute and we will use
00:14:21 – this class attribute edit data and
00:14:23 – square e cold as selector and from the
00:14:25 – attribute we will get it a particular
00:14:27 – employee
00:14:30 – now friends are code is ready for robbed
00:14:33 – a data through bootstrap model by using
00:14:35 – PHP script with ajax square e so i have
00:14:39 – saved this code and check out what in
00:14:41 – browser
00:14:46 – friends you can see that employee today
00:14:49 – like employee named with it and view
00:14:51 – button and HTML table when we have click
00:14:54 – on edit button then bootstrap model has
00:14:57 – appeared on webpage with HTML form
00:15:00 – filled with particular employee details
00:15:02 – from here we can change employee details
00:15:05 – and by click on update button then
00:15:08 – particular employee data will be updated
00:15:11 – and we can show updated data by click on
00:15:13 – View button here we have used ajax query
00:15:17 – and whites query we have got employee it
00:15:19 – from that button we have created all
00:15:22 – employees separate edit button with
00:15:24 – different and in the set we have store
00:15:26 – employee and by using jquery code we
00:15:29 – have get employee it from button and by
00:15:31 – using ajax we have fetched that employee
00:15:34 – data from database and then after we
00:15:37 – have display that data into bootstrap
00:15:39 – modal HTML form field and an HTML form
00:15:43 – we can change theta and by clicking on
00:15:46 – update button we can update data into
00:15:48 – mysql database by using ajax request
00:15:52 – method so friends if you liked this
00:15:55 – video tutorial please share this video
00:15:58 – tutorial with your friends or even you
00:16:00 – can also share this video on social
00:16:02 – media also
00:16:04 – friends you want to get more update of
00:16:07 – my video so friends you can subscribe my
00:16:10 – youtube channel friends you can also
00:16:13 – like my facebook page also wore you can
00:16:15 – also follow webs listen on Twitter


Video Url:
http://youtu.be/uXyySFPckys

(Visited 12 times, 6 visits today)

Comments

comments