PHP PDO CRUD with Ajax – Update or Edit Mysql Data [w/ subs]



00:00:00 – hello friends this is third part of
00:00:02 – video series like how to make rod system
00:00:04 – by using PHP data object model with ajax
00:00:08 – in this part we will discuss how to
00:00:11 – update the red mysql table records by
00:00:14 – using PHP data object model with ajax in
00:00:18 – our previous video we have seen how to
00:00:20 – create new records or insert new records
00:00:23 – by using ajax method with PHP data
00:00:26 – object model
00:00:29 – in first video we have fast data from
00:00:32 – customer table and display on webpage on
00:00:35 – her table format then at that time we
00:00:37 – have create update link of all data at
00:00:40 – that time we have store customer it
00:00:43 – attributed and we have defined update
00:00:45 – class in class attribute so for update
00:00:48 – data first we want to fetch data from
00:00:51 – table
00:00:53 – so we have rights query codon update
00:00:56 – class a selector on click event so when
00:00:59 – we have click on update link of any
00:01:01 – customer then this code will be execute
00:01:12 – under this first we have right
00:01:15 – variable is equal to dollar with this
00:01:17 – selector with attribute method and under
00:01:20 – this method we have righted attribute
00:01:22 – this code will fetch value would
00:01:24 – attribute of customer on which we have
00:01:26 – clicked by using this selector and
00:01:28 – attribute method and store into this set
00:01:31 – variable
00:01:33 – then after we have right one action
00:01:35 – variable is equal to select a value of
00:01:39 – this variable we will use in PHP code
00:01:42 – for define action
00:01:44 – after this we have right ajax method and
00:01:47 – under this method we have right first
00:01:49 – method like URL set to action dot PHP
00:01:52 – page
00:01:56 – then after and second option of right
00:01:59 – method said to post here we have defined
00:02:02 – post method force and data to server
00:02:05 – in third option we have right data
00:02:08 – option in this option we have righted an
00:02:10 – action variable we have send this data
00:02:13 – to server
00:02:15 – then after we have right data type
00:02:18 – option set to Jason here we have defined
00:02:20 – Jason data type so we will receive data
00:02:23 – from server and Jason format
00:02:26 – lastly we have right success callback
00:02:28 – function this function will receive data
00:02:31 – from server and it will be called if
00:02:33 – it's and request successfully
00:02:37 – under this function first we want to
00:02:40 – load customer modal on webpage so we
00:02:42 – have right dollar with modal good
00:02:44 – customer modal with modal method and
00:02:46 – under this method we have right show
00:02:48 – this code will display model on web page
00:02:51 – then after we want to change title of
00:02:55 – modal so we have right dollar with modal
00:02:58 – title as selector with tax method and
00:03:00 – under this method we have right taxed
00:03:02 – like update records this code will
00:03:05 – change model title when it will be load
00:03:08 – after this we want to change the value
00:03:11 – of modal action button so we have right
00:03:13 – dollar with button in action with value
00:03:16 – method and under this method we have
00:03:18 – right update so one model will load then
00:03:21 – button value will be changed to update
00:03:23 – then after we want to assign variables
00:03:26 – value to heaven filled with attribute
00:03:29 – that is equal to customer bed so we have
00:03:31 – right dollar with hidden fielded
00:03:33 – customer did with value method and under
00:03:35 – this we have right variable lid after
00:03:38 – this we want to assign value to text box
00:03:41 – with it first name so we have right
00:03:43 – dollar with text box said first name
00:03:46 – with value method and under this method
00:03:48 – we have right data dog first name
00:03:50 – variable here we have right data dot
00:03:53 – first name because we have defined Jason
00:03:55 – data type in ajax so value updated has
00:03:59 – been received from server and first name
00:04:01 – is Jason array same we have defined
00:04:05 – value to text box with attributed last
00:04:07 – name so we have right dollar with tax
00:04:10 – box with attributed is equal to last
00:04:13 – name with value method and under this
00:04:15 – method we have right data dot last name
00:04:18 – this way we have assigned value to last
00:04:20 – name textbox now we have write PHP code
00:04:24 – for fetch particular customer data data
00:04:27 – at action dot PHP page so on this page
00:04:31 – here we have right of statement with
00:04:33 – conditions like dollar post' action
00:04:35 – variable is equal to select this
00:04:38 – condition will check value of dollar
00:04:40 – post' action variable is equal to select
00:04:44 – that it will execute this block of code
00:04:46 – under this block first we have right
00:04:49 – dollar output variable is equal to array
00:04:51 – data type and this variable we will
00:04:54 – store customer data and reformat and
00:04:57 – convert after eight adjacent string and
00:04:59 – send back to Ajax request after this we
00:05:03 – have right dollar statement variable is
00:05:05 – equal to dollar connection object with
00:05:07 – prepare method and under this method we
00:05:09 – have right select query like select star
00:05:12 – from customers where is equal to dollar
00:05:14 – posted variable limit this method will
00:05:17 – prepare a statement for execution and
00:05:19 – return statement of objects
00:05:23 – now we want to execute this select query
00:05:26 – so we have right dollar statement object
00:05:29 – with execute method this will execute
00:05:31 – prepare statement then after we have
00:05:35 – right dollar resolved variable is equal
00:05:37 – to dollar statement object with fascial
00:05:40 – method this method will return an array
00:05:42 – containing all of the resultset rose and
00:05:45 – store into this staller result variable
00:05:49 – now we want to fetch the array of dollar
00:05:52 – result variables so we have used for
00:05:54 – each loop so by using for each loop we
00:05:56 – can fetch the array of dollar resolve
00:05:59 – variable
00:06:03 – under this for each loop we have right
00:06:05 – dollar output first name variable is
00:06:08 – equal to dollar row first name variable
00:06:10 – here we have store first name table
00:06:13 – column records has been stored into this
00:06:16 – dollar output variable then after we
00:06:19 – have right dollar output last name
00:06:21 – variable is equal to dollar row last
00:06:24 – name variable here we have store last
00:06:27 – name table column data has been stored
00:06:29 – into this dollar output array
00:06:38 – so we have stored data into our dollar
00:06:41 – output array variable and keys like
00:06:43 – first name and last name
00:06:45 – now we want to convert this array into
00:06:47 – adjacent format and sent to Ajax request
00:06:51 – so we have right tackle statement with
00:06:53 – Jason and code function and under this
00:06:55 – function we have right dollar out what
00:06:57 – variable this code will convert PHP
00:07:01 – array to Jason string and send to Ajax
00:07:04 – request
00:07:21 – now our code is ready for fetch
00:07:23 – particular customer data and load of
00:07:25 – data and to modal text box so when we
00:07:28 – have click on update link then model has
00:07:31 – been pop up and under model we can see
00:07:34 – customer data also and now we can see
00:07:36 – button value has been changed to update
00:07:39 – so we can change the value of text box
00:07:42 – and click on this button then data has
00:07:44 – been update but we have already right
00:07:47 – ajax request on this button with
00:07:49 – attributed for inserting data so we can
00:07:52 – use this code for updating of data also
00:07:54 – here you can see we have got the value
00:07:58 – of first name last name textbox we have
00:08:01 – also get the value of customer hidden
00:08:04 – field and store into this set variable
00:08:06 – and we have also create one action
00:08:08 – variable and and that variable we have
00:08:11 – stored value of button
00:08:13 – but now button value is update so this
00:08:16 – time value of action variable is equal
00:08:19 – to update and this all data we have sent
00:08:22 – to server by using action variable and
00:08:25 – then after it will display updated data
00:08:27 – on web page by using fetch user function
00:08:33 – so we have go to action dot PHP page for
00:08:37 – writing PHP code for robbed a data so on
00:08:40 – this page here we have right of
00:08:41 – statement with conditions like dollar
00:08:43 – post' action variable is equal to update
00:08:46 – it will check value of dollar post
00:08:49 – updates variable is equal to update then
00:08:52 – it will execute if block of code under
00:08:55 – this block we have right dollar
00:08:57 – statement variable is equal to dollar
00:08:59 – connection object with prepare method
00:09:01 – and under this method we have right
00:09:03 – query like update customers set first
00:09:05 – name is equal to double colon first name
00:09:08 – last name is equal to double colon last
00:09:11 – name where it is equal to double colon
00:09:26 – now we want to execute this prepare
00:09:29 – statement with Ray name values so we
00:09:32 – have right dollar result variable is
00:09:34 – equal to statement object with execute
00:09:36 – method and under this method we have
00:09:38 – right away with keys like double colon
00:09:40 – first named with value dollar post first
00:09:43 – name double colon last-named with keys
00:09:46 – dollar post last name variable and
00:09:49 – double colon it with value like dollar
00:09:51 – posted variable this method will execute
00:09:54 – prepare statement with an array of
00:09:56 – insert values with named parameters
00:10:00 – now we want to check data updated or not
00:10:04 – so we have right of statement with
00:10:05 – conditions like not empty function with
00:10:08 – dollar resolve variable this will check
00:10:10 – value of this dollar variable is not
00:10:13 – equal to blank then it will execute if
00:10:15 – block of code and under the suite of
00:10:17 – right acco statement with message like
00:10:20 – data updated and this will display to
00:10:22 – user on front side so our code is ready
00:10:25 – so we have saved this code and check out
00:10:28 – what in browser friends you can see that
00:10:31 – when Paige has been loaded then at the
00:10:33 – time customer data has been loaded an
00:10:35 – HTML table with update and delete button
00:10:39 – link so when we have click on update
00:10:41 – button then model has been pop on
00:10:43 – webpage with data already loaded under
00:10:45 – text box filled and now button name has
00:10:48 – been changed to update so we can update
00:10:51 – data by clicking on this button so we
00:10:54 – have changed customer details and click
00:10:56 – on update button then message has been
00:10:59 – pop with message like data update so our
00:11:02 – code is working on how to update or edit
00:11:05 – mysql data by using PHP data object
00:11:09 – model with ajax without refreshing the
00:11:11 – page in next part we will discuss on how
00:11:14 – to delete or remove data by using PHP
00:11:17 – data object model with ajax if you like
00:11:21 – this video please share this video with
00:11:23 – your friends or even you can also share
00:11:25 – this video on social media also friends
00:11:30 – if you want to get more update of my
00:11:32 – video tutorial so you can subscribe my
00:11:35 – youtube channel friends you can also
00:11:37 – like my facebook page or you can also
00:11:40 – follow webs listen on Twitter


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

(Visited 9 times, 3 visits today)

Comments

comments