PHP CRUD Operation with MySqli Database - Step by Step | Daily Tuition | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

PHP CRUD Operation with MySqli Database - Step by Step

teacher avatar Daily Tuition

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

9 Lessons (1h 42m)
    • 1. Overview

      4:19
    • 2. Setup Environment

      4:44
    • 3. PHP CRUD 2

      7:05
    • 4. PHP CRUD 3

      8:02
    • 5. PHP CRUD 4

      11:01
    • 6. PHP CRUD 5

      21:25
    • 7. PHP CRUD 6

      9:28
    • 8. PHP CRUD 7

      17:34
    • 9. PHP CRUD 8

      18:01
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

206

Students

--

Projects

About This Class

PHP CRUD Operation with MySqli Database - Step by Step

In this class, we going to learn how to create, read, update and delete data using PHP and MySqli database. If you are a beginner and you want to learn how to create, read, update and delete data. Enroll now to learn....!

About Me!

              Hey everyone, I'm Akshay Kashyap and have 6 years of experience in web development. Since 5 years I am working as a freelancer. I love to help everyone. Making new things in programming is my passion. It's all about creating new applications, websites, and graphic designs. Well In this class I am your instructor. I love to learn new things and share them with everyone.

              Now let's talk about who can take this course.

For whom this course is for

                Anyone can take this course who has knowledge about HTML and CSS. Along with that, you should have a basic understanding of PHP. So it's easy to understand how things happen. 

So what are you going to learn in this class:

  • In this class, you gonna learn how to create PHP data. You will understand how to insert data in the database using PHP forms. We are using post and get method to understand these things.
  • Then you will understand how to read data from the database. We will read data from the database and display them in the bootstrap table. 
  • You will learn how to update data from the database. We gonna create edit button to select data and make changes. Then by clicking on the update button, we can update that data very easily.
  • At last, we will understand how to delete data. We not only delete the single row but also delete all rows in the table if need. 

So basically you don't need to worry about anything. You will understand everything steps by step. I am gonna teach you how to use this CRUD technique to 

If you have any question don't forget to comment and share feedback after this course. Your rating is very valuable to me!

Thank you...!

Meet Your Teacher

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Overview : everyone on. Welcome to PHP class in this class, we gonna learn how to make crude operation with PHP on mice will developers we gonna learn everything step by step Really from scratch. This class is for bigness to understand the page people operation. Let's see what we're going to create in this class. So in this tutorial, you're gonna learn how to create PHP crew operation. With my skill identities, I will show you a very simple technique to create Read update until the data from the database. This tutorial is for beginners. So I'm not gonna are any advance toppy like Ajax on object patterns in this video. So I specially made this video for beginners to understand the crude operation. So let's see what we're going to build in this tutorial. So, as you can see, I have here bookstore application in this bookstore application. I want to add books in my database. So here the i d off my book, the name of my book, the Publisher and the prize. So I want to add my first book in my data base back to first book. I'm gonna just click on this book name text box and just base If I BHP here because I want to first at the PHP book here. And suppose the name of my publisher is daily. So I'm going to say here daily, and the price is $59.99 right now to create this record, I'm cottages. Krepon, these three important. When I click on this great Britain, you're going to get a mass a chu record successfully inserted on Venuti pressure data Vase , You're going to see this record right here, find. So this is your first record to insert your next record. I'm going to just say here my SQL I specified to publish your name. So I'm just here at school and the price is going to be 49.99. Right? To insert this record, just click on the create button when you refresh a little bit is by taking on this report on you're going to get two records in your database is why Now let's say you want to update this first record on Just change this publisher to please people Fisher for that, you just need to click on this area, protect. So when you click on the edit button. You're going to get these values in the states boxes, so I need to just changes daily to Ph. B publisher, right to update this value, Just click on this update button. So when I click on this update button, you can see this message later, successfully updated and will replace your database. You have these updated value now, just after that, let me show you how to delete data. Now, let's say I want to delete the second record to delete the second record. I'm going to just click on the edit button. So when I have this second record in this tick boxes, I'm going to just click on these daily Britain. So when I click on this delete button, the second record is diluted and you can see a message they called Dilated successfully. And when the refresh your database, you are going to get on the Wonder Court. And if you try to insert your next record like this so I'm going to just say here JavaScript on the publisher is going to be JavaScript. Action on the price is 35.99 on when you insert his record in the database. You're going to get this message they call successfully inserted and venue depression, data, ways. You can see you have these one on told value because we already deleted my second value. Now, let me show you how you can delete all records at once. So, as you can see, we have only four buttons up here. If I create more than three record, ever get delete all button right here. So if I just duplicate this record and create a new record and if I created one mode record by clicking with this create button, I'm going to great delete all button right here. So when I click on the create button, you can see I have here a did it all, Burton, because I have more than three values, right? So when you have more than three values, you can see we have these Did it all buttoned to delete all this records. Whatever. I want to delete all this records at once. So when I click on delete all button, this is going to deal all this record. Let me show you how perfectly called this deal. All button this world did all these records and you can see all recorded it successfully. And if I refresh your date of its you can see you don't have anything on. You can see the i. D. One here because you don't have anything. So you're going to insert your first family now? Now, let's see how to create this beautiful cooperation with PHP and MySQL database, and I will show you to step a step process to create this beautiful cooperation. So what are you waiting for? Take my hand to learn this class and I will see you in the crops. 2. Setup Environment: Now let's get started and understand how to create this PHP cooperation with my school I database. Let me force inform you that this is only a beginner tutorial to understand how to create the school operation. If you're thinking that I'm going to insert Ajax on object patterns in this tutorial than this is not going to happen in this tutorial. This tutorial is only for beginners to understand how to create crude operation with just a PHP functions. So let's get started and understand how to create that now to work with PHP. Unity first installed a Vape summer, So I'm going to use the example Web server toe work with page being if you want. You can use any other with silver as well, just like Van Server or easy Ph. B and so on. But I'm going to use the exam server because it's very lightweight on is it? Use someone to just open the exam control panel. I already installed his example rates over on my local system. If you don't have this weeps over, just open your browser on such for example on just aren't that just click on this force website now from this outside, you can download these example Weight server for your local system. You can download this Web server for Windows Mac toys and relax as well, right? I'm going to use this exam server for Windows, so I'm going to install these exam server from this link. Right. So I will just click here to install PHP 7.3. I'm not going to Donald this exam server, but because I already have this exam server install in my local system, Once you download this application, just install these right clicking on the exit, pile on, just praise next. Next, and just finish the process. Once he was told his application. Just open it on. You can see this type of control panel how to start his Apache server. You can just click on the start button and to start the Maya school database. Just quit on this start button. So I'm going to just click on the start buttons to start this per server. So as you can see, the server is started. Now, I'm going to just minimize the server and just open my C drive. Once you install this application, you can find this example er in this folder. Just goto Hasty Dark folder. Now, in this folder, you should put your website related stop for each upside you create. It's very to create a folder inside Esta Doc folder and then put content inside that to a vote. Conflicts, For example. You can create a tutorial folder inside this wasted off holder to put your crude operation . Right. As you can see, I already have this tutorial folder on in this folder. I don't have anything right now. I'm going toe open this folder in PSP strong. So I'm going to just open the base bedroom I d e Now, if you want, you can use any other I d like we're score need bean and so on. But when I woke with beach be allowed to use peace, be storm I d. So I'm going to use this PHP storm. I d for this tutorial. So, in this idea, as you can see, we have this tutorial colder. Now in the peace, be strong. I d Just click on this file on select New project on just opened this tutorial folder created in the S T dog folder Right now in this folder I'm going to create a new project. So I'm going to just right click here and say new directly and named this territory crude and just praise Enter. Now, this will create a new folder. Grow here Now, in this group folder, I'm going to just force create in the extort piece refile. So I'm going to just select the PHP file and just place if I file name index dot PHP right . The file name extension is here, so I don't into space If I did not psb extension right here. So I'm going to just specify the name off my file here on Just praise. Okay, Now, as you can see, if we have this indexed are petrified Here on in this file, I'm going to just say equal on just brained Welcome BHP, right, Save the file. And now just open the browser and to know your exam server is running or not. Just type your local host. I'm just praised Ender. Right? So you have these exams over details. So as you can see, if we have beach be 7.3 version installed in our system with this exam server, not once you told this exam server. You can use Apache my skill that Toby's PH. B and model programming languages. Now, just after that, to execute your index dot PHP file, just say here local host forward slash Vittorio the name of your folder created in the SD Doc folder and then specify your project territory name. So the name of my project directory is crude. So I'm going to just say here, crude and then specify the filing. So I'm going to say here, Index nor PHP. Once you press enter, you can see we have these Welcome Ph. B next year. Right now let's get started and create this amazing crude operation. 3. PHP CRUD 2: now I'm going to force designed the application and then work with PHP and MySQL database. Right? So I'm going to just greater of this statement. I just enter here an extension mark and praise tab. Right. So you have these simple estimate five sleeper here and just I'm going to just change this title on a train. This title, Two books. Now just order that now in this project, I'm going to get the help from a bootstrap to glorify this template on also used front or some icons to use icons in this project. So I'm going to just open the browser on search for both. Strap on from this first outside. So I'm going to just click on this. Get started on use the Syrian to link this bootstrap library toe my application. So I'm going to just press this link here on this script. Copy. Descript on just based is just before disclosing body time. Right here. Right now, the bush warbler ivory is linked with your application. Now you can work with bootstrap. Now what I want, I want to use icons in this project as well. So I'm going to just opened this new time and so much for formed. Awesome. On from this rip side, just click on the start using free on. As you can see, this is your cdn from contentious co operatives on a per state just before this post op right here. Now, you can use any pre icons off photos on the site in this project, right? Just after that, I'm going to just create a custom style sheet here. So I'm going to just click on this project directory on just saying new styled our seas as well. So I'm going to just say here, stand shit on just piece of my name style. Lord ceases. Now I'm going to just let this file doing. They start Ph. B. So I'm going to just great here a command I see here, Custom style should right and just Lingus file. And in the HIV vacuum build, I'm going to just specify styled or diseases. Save the changes on now. Just after that, I could just create here Which one? Heading time. Does this estimate file on? Specify welcome PHP. Save the changes on when you reload your application. You can see you have these. Welcome Ph be heading time right in the body section right here. I want to force create here a main time from going to just hear me. So in this man die, I want to create a division title with the class container. So I'm going to just create your division time and space of my class gun dinner. Now, as you consider, we created this dish attack and specify the clouds container. Instead of doing this, I want to show you the simple step to create this division. Time with the class container. Just specify dot here and say container and PRESTA to create a division time with the class container Like this. Right now, Once you have this container, I'm going to just create H 100 dag on specified text book store. Right. Say the changes on as you conceive we have this bookstore here. No, I want to add an icon here, so I'm going to just stand I that here I just visit my class fast. If a swatch book right. And when I save it, you can see here we have this icon right here. All right, now I want to center the stats. I'm going to just specify here. Text center, class off. Bootstrap. Save the changes. You can see we have the states on the center of the document. I'm just after that. I want to add some patty. So I'm going to just add here a class So this h one heading time on, specify riding by for specify the dark background. So I'm going to just using boost R b J in our class on. I just want to specify the light text color. So I'm going to just to hear text light on. I want around this corner. So I'm going to just to hear but owned it, right? Save the changes once you re lord that you can see this type of result, right? I'm going to add a space right here like this. And now just often these each one hitting bag right here. I'm going to just create here another division tight with the class deflects. I'm going to just to hear dog deflects. So this class will specify display flex property today's dirt and I right now in this division time, I'm going to add a form I'm going to space with his action after built letter in this tutorial. Just after that, I'm going to specify here. Method post on. I want to specify a class with 50. So this is going to specify 50% of it to this form in this form, I'm going to create here a division tag with the padding, right. I'm going to create a division time with the class filing by two. So this class will space for the top important parting to this division time, right? We used this class right here as well to specify top and bottom Patty. Now in this division tie, I want to create a bookshop in port tack like this. I want to create this boost of input tight right here. So I'm going to just copy this cold from here on. Just copy Days on Pressed it right here. Say the changes on when you reload your page. As you can see, you have this in contact right here. Now I want presented this text box. Some couldn't just busy. If I hear for this, do this time justify content center. So this will send a these textbooks say the changes and reloaded right now. Just off that, I want to change this at a time And these placeholder. So I'm going to just get it off this hard area tiene on use icon here. Now here. I want to add an icon. If you never worked with pointers on the site that it's very simple. Just open the front of some website on click on these icons right here. Just search for your icon. So I'm going to just take your i d. So I'm going to select this body. Icahn now, just over that, just copied his eyes. Dim attack on place it. Whatever you want in this system a file. So I'm going to just place it right here. Right, Savage? INGE's on when he reloaded. You can see you have this icon right here. Now I want to add some booster classes to change this textbooks. Now, whatever. I want to change this background color. So I'm going to specify a class to these devices back and say BG Morning. So this is going to change this background color right now? Just after that For this import back, I'm going to just specify also complete. Oh, on just out of that, I'm going to specify the place holder on here. I'm going to specify I d save the changes. And when he reloaded, you can see you have this idea place. Order here. Right now. Let's create a few more things. Boxes right here. 4. PHP CRUD 3: now just talk to that. I'm good. Are the another take box where we add the book name. So I'm going to just click on these. I'm going to create a diversion time with the class putting Talk to right now in this division back. I'm going to create the same big boss. I'm going to the scope of this cold on paste it here. If you're using a simple estimable, then you need to use the score again and again to create your template. But you know that we're using PHP. So instead of coping this cold again and again, I can use a function to create this temperate like this If I just copy the states on just getting off the stakes from here and create a new file. So I'm going to just create a new tragic to hear on name decided three BSP in this directory, I'm going to create a new file beach before you on just beautify, albeit refined name component. Now let me show you how you can create these experts using a function. So I'm going to create here a function on name, dysfunction, input element in this function. I'm going to just create a new variable. So too great a variable. You can use the dollar sign on, specify the variable name. So I'm going to specify element here on specified equal time on in the double goat. I'm going to just place these esteem in court right here, right space. If I hear a cynical run on, just say equal in the mint and just call dysfunction in this indexed art piece before you, you can see these input text box right here like this. If I just open the day, start Petri file and just include this component or patient file up here from going to just call here b HB and just close this up and I'm going to just include this component are PHP file using required ones. So I'm going to just say here require once so dysfunction will include this file. If the file is not exist right now in this function, I'm going to just specified double coat, double door, the forward slash and then specify crude the project name, then the peace before door on the component dot Peachtree fire, right? Just talk to that. I could use dysfunction right here. So now if I adhere of BHP seen dies and if I call here input element on city changes on execute my application you can see if we have this idea right here as well. We have this duplicate in port text boxes when it to specify different place. Order here on the icon for that and would open the component are pitch viol on Instead of specifying the hard coded values here, I'm going to just add here a perimeter. I'm just great available. I call Onda specified this icon variable right here into adopt specifying these icons are correct value like this. So I'm going to just create another pedometer here. Ah, good available place holder on named his perimeter placeholder on. I'm going to to specify this place holder right here Instead of specifying this placeholder hard coded values I'm going to just say here place wonder right now to stop that. I also want to specify a new battery boat so these import takes box. So I'm going to just create here another perimeter ni I'm going to specify this name Attribute right here Name is equal to name readable right now Just after that. I also want to specify value are to build do these things box. So began space of our values when we call this function. So I'm going to to specify a centimeter value and I can specify this value variable to devalue attributes like this. Right? Save the changes on just opened index dot PHP file and specify arguments to this input element function. Now here and put to specify the force argument. So I'm going to specify the double coat on space over here I compare emitter. So what is this piece of fighting force I commend? I call So I will adhere. I die with the closing idea on Just specify class fast. If a book now, just off that I was basically the second argument, which is placeholder. So I will name this place order book name and then specify the tour argument name. So I was specify here book underscore name and the last I want to specify value to this import take box. So I don't want to specify any value to the state ball, so I will live these as it is. So I'm going to to specify the empty double quote here, save the changes and if you open your application on executed, we have this book I can hear on the book. Name, place, order. You can do the same with this force. Take box. Also like this. If I just copy this statement and just get it off this festival division time and placed this function again. And James, this icon too fast if a I d match on the place under off the first eggs box is I d on the name off the four stick votes is book I d on the value is empty. When I said this Andi looked a page. You can see we have this text box using this function. So using this technique, you don't need to repeat yourself, right? So I'm going to just create two more big boxes right here. So just great here Egyptian time and specify class rope in this role. I will play it according class on in the first column. I want to create here and input time. So I'm going to discover the statement basted here and just change this argument values. So I'm going to just change this icon do people, Daddy, This place with her name is began probably sure The name attribute off this in Protective box is book publisher. And I believe this fourth argument as it is, right? Save the changes on when you reload your application. You can see you have this publisher take box here. Now, just talk that I'm going to read another column right here, so I'm going to just hear it call on base the function again. James D gone. So I would just use here dollar sign. Then I will change the placeholder to Price. And I want to change his name to book price on live the last argument as it is, serve pigeon juice on really reloaded. You can see we have these two text boxes here, so you don't need to repeat yourself to create this. Takes boxes. All right, I'm going toe aren't some padding, so I will just on here, writing top to want to remove some parting from the forced involves. So I will just specify here Burning dump. Do you now? Just over that. I want to create here. Four patents each button represent their own functionality. So we're going to clear here, create, read, update and delete button. So I'm going to just create here a division time. Just out of this division type right here. Create your division back and specified class deflects in this deflects last. I'm going to create here a button with the text. Create, right, Save the changes on you can see you have this person right here. Now what I want. I don't want to create this. Portend. Using s Timo isn't off creating this button using esteem attire advocated a function like this input function and clear this presents. So I was just getting off this text on just open the component art patron file and create a new function right here. 5. PHP CRUD 4: now, in this component, not patriot file, I'm going to create a function on name dysfunction. But on element, right and dysfunction, I'm going to create upper Done. So I'm going to just create available Betty Ann on. I want to specify an 80 mil attack here, so I'm going to the specified double coat on right here. I will create home button. So I'm going to just see here, Button. I'm just closed this button right now with this button and we'll pull, specify name at the world. I'm not going to specify the hard coded values here. Instead of specifying the hard core values, I will specify a perimeter here. I'm going to just create a perimeter and just basis for that parameter variables. My family just scared here opposed parameter video, and I d Then I will create here state grass. Then I will say it next. Then I will specify name and the last I will specify already built right. So as you conceive, we have full pattern, better values, quotas, but in function. So I'm going to just use this parameter values and specify two different attributes. So for this Nemat revealed, I will specify this name anti birth right now. Just after that, I will speak very class to this bottom and specify this time Class variable right here. So I'm going to just take your style cross right just off that it was specified I d specified his beating. I d right here on. Just offer that to specify text. I'm going to just use these perimeter. So I'm going to just say here text right now just off that, if you want to add any attribute to this button using this last perimeter. So I'm going to just basic by here and the single coat attribute, right. I'm just off that specify simcon and just say equal, obedient. Save this file and just open ended Start beach before you on right here. What I'm going to do is I'm going to just call this PHP function right here. So I will just say here but on element right now you know that the post perimeter is but an I d. So in the double gold, I will say video here, do you? But I will specify the second argument. Bettis, stand class. So I want to specify here median BT in success So this is a booster class to specify light green color to this button, right? You start to that. I was specified. Text I want to specify here, Create text. So I will say here placate. I was placed my name to this button, so I'm going to specify name 38 on Believe this last attributes as it is and just ain't the statement using semi colon on if you lower your page, you can see you have these buttons here with the light green color. Now, as you can see, we use here, create text Instead of specifying these three attacks, I'm going to use an icon here. I'm going to just get it off this text on on here. An icon on specific class friends if they plus right, save the changes. And you can see we have this plus sign here, right? Not just offer that when you have, like on. I'm going to specify the bootstrap built it. So when you hover over your mouth, all this button, you're going to see the text, right? So what I'm going to do is I'm going to specify the bootstrap building for this ban emitter . I would just specify a bootstrap bill tape. So it was out here. Booster. Patti Russo, say data da. Go on. Just busy for here. Built in, right? No, just off that. I will just say it did a place me Bottom on Daido is going to be created. Save the changes. And when you have your mouse over this button, you can see this. Create a text right now. If you don't want to use the stool, Dave, then leave this perimeter as it is. It doesn't matter right now. Just off that, I want to create my next button. So I'm going to just copy the statement on investiture in stops whistling the same value of the specified here i d video entry. The success is going to be by Muddy on the icon. He's sink right? All right. Just stop that for this name at the root. I will specify do. And for this to Dave, I would just be by here, I think say the changes. And when you reload your application, you have to treat. But I will do the same. So I'll just copy this dead man bested here on Just change this radiant I d so I would just say Bt n of date than just off that here, I would just get Look, this primary text on just piece of light border on the icon is going to be ban up. Right? And I was just jeans, the knee do of it, and I was just changed his duty to update. Right, Santa genius on If you re luria application, you can see you have this update button right here. Copy. The state man posted here again for the last button on just changed his i d to begin billet . How urgent this class as well. So it's a median danger Andi icon is going to be, if a trash out. Right? You start with that, I would change the name. Do deal it on this today become Did safety changes on when you re loaded behind this deliberate in here, I now I will add some style to this button, so I'm going to just open the style sheet. So it was open the style or Stasis file on right here. I will first select the deep Lakes class and then I will select the Britain. So I will say, But in here Now I want to specify here margin to this button. So I will say margin And I want the space of a year 1.5 p. M. On and Zittel bind 6 a.m. Margin that I will space of my body 0.5 p. M. 2.4 year saying the changes so really reload your application. You can see you have your Britain's with padding and margin right now. Just talk that I want to send her this all buttons. So I'm going to just opening day start peace profile. And right here just after this deep Lex falls, I will just say justify contend center. So this will center all these buttons like this right now, just after that, to discredit of his values. I'm going to create here a table. So I'm going to just create here. It's just after this division time right here. I'm going to create here a table, so I'm going to just add a comment here. Bootstrap table. Now here. I was just at a different dark with the class deflects table data right now in this Dave, I had the table die with the class. They will. They will stooped table don right on in this table are forced. Create table head. I will just say people here on a specified class de head dark right now in this devil head , I'm going to create a table hitters. So I'm going to fall straight here table for on get forced. They will hit her. So we're just basically I d s day on Specify fighting Just after that, I had devil Hey, bang on space. If I book me, then I will add publisher Book price And the last I was just hard the idiot Britta. All right, so this ad 80 hitter here, save the changes on when you reload your page. You have this bootstrap table here. When we create this table, I want to specify some marching toe this table. So I'm going to just open this time. Lord, since this pile on in this file, I will just pull space. If I deflect class on, specify the table now in this table, I would specify the margin, so I will just say here, Margin on. Specify 1 p.m. On. Then Ian margin here. When I save it on reload this page, you can see, we have this margin specified to the stable. Now, just off that open the index dot PHP file on here. I will specify some data, so I'm going to just be support some dummy data in these table data. Now, hear, what I'm going to do is I will just forced create stable body. So it does say here, table body on specify I d de body on interstate body. I was basically some demo data, so I will just add here they will vote. So what? I'm going to do it. I would just start here Table data on space if I my first ideas. So I will just take your fun. They will data on just basic by the book names. Oh, just a book. Me then specified table data on that space of party. The publisher names. I will just space by my name off my channels. I would just say destitution and then I will just petrified table data with the price. I will just say here 44.99 I save the changes on vineyard reloaded. You can see we have this data in this table now. I would just basically an icon in this table. So I was just speaking for here, and I can so just add table data. So when you click on this icon, you can get the values in the text parts. So when you click on this icon, you can get these values in the text boxes. So I will show you that after a few minutes. Right? So now just after that What? I'm going to do it. I will just sat here and I call inside. Here I die on specified class fast if b edit parents visit by begin edit Custom cross So we can change the style. So this icon save changes And when you re loaded, you can see you have this icon right here. Now I want to space for some style to this. Icons are open. My style dot sees this file. I'm going to just select this icon. So what? I'm going to do it. I would just like this table on then, to like this. Begin read it right. And then I will first base for the color. So just say color, light settlement And then I will just say go, Sir. Pointer Say the changes on when you re loaded, you can see you have this light Solomon color to this 80 icon. And you have these cursor here right now. Just talk that over the index dot PHP file and right here. 6. PHP CRUD 5: now, as you can see or design is very now the time is to create a new databases in MySQL database. Right. So I'm going to just open my exams over and just click on these My skill at me right here. So once you click on that, you can see you have this new toe open in your browser on in this town, you can see you have a baby at me. And here, as you can see, if you have these, my skill thereof is now here what I want. I want to create a new database so I can click on this new on create my new database. But instead of creating a new date of is right here, I'm going to create that using a PHP script. But what is the benefit to create this database using PHP script? So many cloned this application. You don't need to create that database manually on create a new table. Instead of creating a database manually, you just need to execute the application. This will automatically create a new databases with a new table. Right. So when you clone it, you don't need to create a new data arrays So that is why we're going to create a data race using PHP script. So I'm going to just open my I d on right here in this I d I'm going to create a new file in this speech before dark. So I'm going to right click here and say new PHP file Right on. I'm going to name this file, baby. All right? No, just talk to that. When I have this file in this file, I'm going to create a new function. Now, in this file, I'm going to create a function. So I will just say function, create maybe right in dysfunction. I will post create the server name variable. So I will say several name is equal to local host. Then I'm going to greet a new variable and named these user name. And now I was specified the user name route. Now, just after that, I'm going to create a new variable fast forward on live this as it is because we did not say any password to my pH. Bad mean. That is why we will leave this as it is just after that. I want to just create a DB name. Variable on, specify the date of his name right here. So I want to create bookstores. I will just say here, bookstore. Now I want to read a new connection with my skilled service. The mind school connect function opens a new connection to my school server. So to get a new connection, I'm going. Just get here available. Gone on just basically equal design and call my ex girl. I connect now using dysfunction. Now this function opens a new connection to my school server and using dysfunction you can connect your PHP script to my school. Data is now the force argument is the host name. So I'm going to just pass these variable right here. The host name off. My application is local host. So I'm going to just say here server, some good parties, several name variable here because we have these local news value in this. Really about just after that, I'm going to cause my second argument. Region The user Someone was here. Use that name, then told her green is the password. So I'm going to pause here. Possible variable. And the last I have here a day. There is some good bars, baby name here, Right? I just After that, I'm going to specify Simbolon toe in the statement. Now I'm going to just create here, recommend and say create connection. Now, just after that, what I want I want to shake that connection. So I'm going to just say here, Jake Connection. So I will just say here a the connection is not successful, man. I won't do Hi. This application on I will specify the error message Connection failed, right? And then every candy need the error message. So I will say my SQL I connect right just after that. Now, if your application is not connect properly, then you're going to get this error message. Now, just off that, I want to create a new database. So we'll just cleared a comment here and say create databases to create a new driveways. I'm going to force create equity. So I will just create, available at scale and specify the minds feel pretty in the strict. So I would just place if I double gold and say create data, please not exist right on specified the video will name right here. So I'm going to just boss here. They re name so this Turkmen will create a new database in your muscular database. Now, to execute, discover on using Ph. B. You need to call my school. I credit now to execute this gritty. I'm good to just say here if my sq lying quickie. So I'm going to call this function So dysfunction performer equity against the later ways. So this function is going to execute this skill credit, right? So what I'm going to do is I'm good. Just pass here the connection Batam in your first. So just to hear connection and then space for my skill, Grady. So we're just to hear this girl. If this function is true, I'm good just to hear ICO databases created right on. If this correction is not successful done, I'm going to just say here l statement and just say equal later while creating a database on along with that, I'm going to con Cardini the other message. So I'm going to say my as well right here and just positive connection parameter right here , not just save it. I just called dysfunction in your index dot PHP file right here. Frank would just call this function up here, so I'm going to just secure the quiet ones. Just go the fire. You right here. Right. And just talk that I'm going to just call this function in these index dot biz trip. I'll so I would just say, here, create a baby, right. Save the changes on reload your application. When you try to connect your beach be to our my school database. You're going to get this error in this error. You can see we have a known database bookstore. You're going to get this error because you don't have this bookstore did it is in your mind , scolded ofhis right. So that is why you're going to get this unknown database bookstore. So what I'm going to do is and will just remove this Ford argument right from here, save the changes. And if you execute this application, you can see you have these database created message. And if you really love your databases from here, you have these bookstore date of this. Now, when you have this bookstore deliveries, you can use that database in PHP to used instead of it. I'm going to just copy the statement on a visit here in stock specifying these equal statement. So I will just get rid of this equal statement and specify the connection property here on just off that, what I'm going to do is unconscious base if I hear a comma and specify my full document, which is the date of his name. So I'm going to just space over here. The winning now, if you wanted to inform my skill, which database you want to use unique to space by this port argument. Now, just after that, once I select his database, I want to create a new table here. So what I'm going to do is just great here. A new pretty. So just to hear a squeal is equal to and it a double gold I want to create Let's go equity . So we'll just basic fly here, create table on just beautify if not exist. I want to create this table books right in this tabo I want to force create my first will, which is Heidi. And then I was specify the data type and teacher and the value is going to be 11 right? And then I will specify and not know. And then I want to increase this. I D by one automatically. Right? So I want to start this I d problem one on increase its value by one. So I'm going to do these using out increment. Right? So just basically here, auto increment onto space for unique value to this idea, I'm going to specify primary key. So with your secure primary key now, just off that, I'm going to just speaks for my second field off this table. So we're just to hear book name on. I want to specify bad care. 25. Right on. I'm going to just secure, not know right on. Just offer that I was basically my poor field, which is in book publisher on specified data type. Right card 20 on the last. I want to specify book price. So I will, just to hear book prize on the data type is going to be float. Find space for cynical in here on just after that, I will just execute this gritty, using my school like witty function, right? So I'm going to just say here a my SQL like, ready on then specify the first connection perimeter. So I'm going to say here connection and then specified the execute devil quickie and then specified the sq equity. So I would suspect if I hear SQL Now, if this function returned to I'm going to just say here equal table created, right are I'm going to just say in the ill state, man, Geico cannot create table, right? Save the changes on just pretty cynical on here. Before you execute this statement, save the changes on when you reload your application. You can see you have these table created masses right here. And if you take a look at this bookstore database, you can see you have these books. Table, write this book staple in this table. You have this I D book name book publisher on Facebook Price filled. Now, just out of that, I don't want to equal any message instead of specifying this equal statement on Go to just return the connection. Right. So when right now, as you can see in this photo, we just falls. Created a new database on store that in available there's good discreet e using my school. I credit just after that. Once we have this database, I'm going to create a new table in that database. So we use SQL query e to create a new date of a stable. Just talk to that ongoing secure disk ready and create a new table and just return a connection from dysfunction. Now, once we have this information, we're going to create crude operation. Right? So I'm going to create a new pile here. It appears people there, I've got to say, a new pastry file on name this file operation right now in this file, I'm going to force include the date of his fire. So just to hear required runs and right here, I'm going to pass db dot PHP file. And now just up that I also want to include this component file. So I was just to hear require ones and in the parentis is I'm going to just say component dot PHP right now. Once we have this file in this operation dot ph profile, I can remove this file from here. All right, I'm going to just open the operation or pastry pile on right here. So I'm going to just call this function here, this one, right? So I'm going to just call days, create debut function here on you know that this function is going to return a connection string. So I'm going to stroll that in the variable like this. Now, once we have this connection string in this variable, I'm going to force insulted data in my data base using this Create Britain. I'm going to just call a comment here and say create but done. Click right on. Just off that I will say here if he said it means it was traced by value to this button. I want to execute this if statement. So I will just basically an argument here, toe, this is set function. So I will just say here, bulls on, just go in the single gold create. Now we're going to call this create button, this one, right? We specify name. Create to this button, right. When you click on this button, you can see this message equal, and I will say, create baton Quick. I'm going to just include this file in that start PHP. So I'm going to just include this file right here. So I will just say here required ones on specify the part operation dot PHP. So the changes I've when you execute this file and now when you execute this file and click on the create button. You're going to get this message create button clicked right now. Just talk to that open operation dot PHP file. Get rid of this equal statement on call a new function. Good. You'd data. We don't have dysfunction yet, so I'm going to create dysfunction right here. So I will just say here function, create data. Right now in this function, we're going to insert these textbooks values in the rate of a stable. Here. In this function, I will first call the text box value. So So I'm going to create here a variable book name is equal to and just call boast and just call the textbooks name. So I'm going to just say here book name. Right. So this is the name of my big box you can see here, right? Once we have these values, I want to validate this text box values on space. If I some security for that, I'm going to create a new function here. Function next box value. I'm just basic fly a perimeter here. Value now in dysfunction. I'm going to just create available things box on call my SQL. I real escape string, right? I'm going to just call this function. So this function escape special characters in a string for use in SQL statement. Right now in this function, the first argument is going to be a connection Street. So I'm going to just pause this connection right here. Now, if you just piece of my connection here, then you're going to get an error message because we don't have this variable in this function to call these global function. You just need to get it off this connection on just basically here, dollar global and in the bracket, you can see connection. Right? So you have this connection valuable right here. Now, just talk that I'm going to just basically here, boost fell just to hear boost and just call here this bad a meter around you. Now, before I execute this function, I need deployed a security against SQL injection. So what I'm going to do is I'm gonna just cut the statement this one and just call dream function in this rain function, I will just basically I post value. Right? So this policy kudos wrong SQL injection. Just talk that once we have this value in the state box. I'm going to just check if if the take box is empty and just basically to take folks rally here so we'll just secure takes balls If this condition became too I'm going to return faults, bills. I will return the things box values I will just say here Big box, right. Surgeon Jay's on. Instead of specifying disposed, I'm going to call this function on in this parent pieces you don't need to call disposed. Instead, you just need to specify the name of your takes balls. So I'm going to just say here book name. Right. So we have this book name value in this book name Variable Now just aren't that I'm going to create a new available on name this book publisher and call the state box of value function on a space. If I book publish here name. I'm going to create a new variable here Unnamed This book price on call this Take a box of value function on just basic fi book. Pricier. Right. So now we have these textbooks values in these variables. Now, once we have these values, I'm going to insert these values in the rate of is so I'm going to force check. I'm going to first check if we have values in this variables. So where did you say here? Book name on book publisher on a book price. Then I'm going to just create here, and it's kill crazy. So now if you have data in the text boxes, I'm going to just execute this. If statement Ailes, I'm going to just execute this l statement. Right. So what I'm going to do is if we have data in the states boxes I'm going to call a skill query. So I'm just lead here equity. So I'll just say here s will ever create a variable on the double code. I'm going to just say in sewed into That's basically your table name here. So I will just say here books Right on. Then I want to specify values in the specific fields, so we'll just piece of light here. Book name the first feel. We're not going to insert any value in the I t. Field because the I t field is auto increment it. So that is why we don't need to specify any value to the I. D field right so in certain values in the book name field. Then I was inserted values in book publisher Field on the last within 30 values in book brides filled. I just thought that I want to space of our values So I would just call here Values on in the parentis is I'm going to call these values in the single court so I will call the single coat on just call book name specify Coma here called the single good. Specify the second value for the publishers. I would say book publisher And then at the last I recall Look right here. Right. So we're going to insert these values in this feels right now. I want to execute this Grady throw. Just call if my girl like, gritty on four school the connection string. So I will just call here No. Well, and in the bracket, I will call the connection, and the second argument is going to be a school statement. So just to hear that's girl. Now, if this function returned true, I'm going to just hear Ekho record successfully inside it, right? And if anything goes wrong, I will just basic for here ills. And here I would just say it her message right on in the ill state, man. Right here. If it did not specify any value and it in the text boxes I'm going to bring here Eagle for white data in the bigs box. Right. Save the changes. So now when you click on this create button, you're going to get this message, provide data in the text box, right? So when I click on this button, you're going to get this message provided are in the takes balls because we didn't specify indeed are in the state boxes. Now what we're going to do is I'm going to just insert a data into steak boxes. We don't need to specify I d toe any product, right? Because we specify order increment value to the I. D. Right. So we're going to force basic by the book name. It's all just to hear. Look, one, the publisher is going to be publisher one on the price is going to be a 35.99. When I click on this Great Britain. The date of this record is created like this. If I click on this create problem, you're going to get this message record successfully created right on. If you refresh this state of its If you people this bookstore and click on this table, you can see you have these values. Look, one publisher on the book price. So now you can see if he successfully inserted data in the database. But now, instead of specifying this equal state man, I want to specify something unique. So what I'm going to really is I'm going Just get it off this equal statement on instead of specifying this equal statement I'm going to create here six heading time. 7. PHP CRUD 6: So to create this H six heading guy, I'm going to just good here a function and say here messages. All right on. I want to create here a function on name dysfunction. Text note right now in dysfunction. I'm going to just create available element in this reliable. I want to store six heading down. So I will just to hear a six heading time and just close it and I want to space back. Clouseau will say class here on install base, defying the hard core value here. I'm going to create here a parameter class name. Specify the perimeter to this class after built like this. All right, I'm going to just great here. A pedometer. Go amiss. CI on. Specify that right here. Right. Specify cynical in here and just say equal element on right here. Instead of specifying the equal straight man, I'm going to scald dysfunction, takes no hold on for specify the class name. So I'm going to just stay here. Success. So this is the name off my clothes, which we're going to create in the style or Jesus pile. And then the second value is going to be the message. So I would just peaceful here a message provide in the big box, right? Save the changes when I reload this page and when I click on this create per tongue, you're going to get this message. You're going to get this passage using six heading back. So we specify this success class toe this 6 30 in time. So I'm going to just open my style CSS file on in this file and we just call the success gloves on just basic fly here background color, light green and then space for batting. One year just off that, I'm going to create a new class here and specify background color no matter on space of our batting one year. So renewed securities, You're going to see these message with this beautiful background. Now, you know that this is a nadir. So I'm going to specify this class, do this message. So I'm going to just open my operation or page file on incidents. Basically this sexist class, I will just say here, area save it injures on when you re load your file, you're going to get this error message instead of spaces like this record successfully inserted message. I'll just copy the state man. All these chicks nor function right here got distressed record successfully in so did and just get rid of this tax on. Just based for here. Record successfully inserted. Right? I just have that. I'm going to just change this letter to success, right? Safety changes. And when you insert your value and now, if I try to insert my next value like this, if I just secure book do probably shirt, too, the value is going to be 33.99. And if I click on this Kate, but on, we're going to get this message record successfully inserted. And if you refresh your database, you're going to get this value look to publisher to on the book price. Right now we know that how to create our in my school, that service. Let's see how to get that data and dispute our data in this table. All right, now, to get the data on the database, I'm going to create here new function right here. So I would create here, recommend and say, get data from my sq did a breeze. So to get the later I'm going to create a function here on name dysfunction. Get data in this function. I will first create. Escalate, Ready. So just create here, Escalade able and store their school. Grady here. Why would you stay here? So they star from looks using the statement. I'm going to get all my fields value not to execute the statement. You know that we have minus career like equity function. So I'm going to just to hear my s career, like, ready on first base if I the global connection variables. So I would just say here globules and in the single gold I would call the connection and then specify these SQL query. Now, this sq equity return a result. So I'm going to store this result in the result variable because dysfunction going to return a statement. So this statement store in this radio balls just under that here I will just say e my sq ally number of crows. So we call this my SQL i number of prose function. So this function written the number of rows in the results. It on just base by fizzled as an argument and here I will just say eve. The result is greater than zero then I would just say here value and just call rule is equal to my esque rely, rich associative Addy. So I'm going to face this result as associative, Ari, right, and then specify it is out as an argument. Now I want to print this state down, so I'm going to just hear equal and in the double court, I would just say I d and I want to bring this data. So I will just say Rome and in the single court I would just say I d right because the name of my first field is I d right. I'm going to just concurrent it This strain with this dot on this double coat and just a year book me. I'm just gonna coordinate with this date of its value, So I will just say roll, I'm just goal here Book name, All right, say of the ginger's not just offer that I'm going to just call dysfunction when I click on the red button, right? So I'm going to just say Here, here it said, Just call this post year and in the bracket, I will just say really here, Right? So when I click on this button. I want to call get data function. Safety changes on pick on this button. I'm going to get the state are right here. All right, so you have this data using this ICO statement Now, I want to print this data in this table. So instead of spaces like these hard core values, I'm going to specify this data in the stable. So I'm going to just get you doll this ICO state man from this function and just do it on. It's up, right? Like this. I just talked that I was just getting off this. If block off this red button on special for that in that start peace before right here instead of space, find this table role on this team. Would it are? I would just get it off this demo data and call the beers be script here on first call here if straight man with it said real Britain, right? I just offer that you know that this gated upon Sean be done result. So I'm going to get this result in the variable, so just create here. Available result on started returned. It are in this veritable. We have this date of its result in this variable. So I'm going to call here if we have Rizzo that in the upstate man I'm going to say while grow is equal to and just call my girl I French is up all right And then space by kind of races. And here what I'm going to do is I'm not going to just equal anything. Instead, I'm going to just end this based rescript and start a new script from here. Right on here. I'm going to create here. They will roll, and in this table rule, I would just create. They will date up in the stable data text. I was all the big rescript like this and just say here equal called the rule this very well on specify here in the bracket I d. And just aim the statement right just off that, I'm going to copy the statement. First it here on does get rid of this I d. And just say book name Hope invested again. Is this I d do book publisher on just his I d do book price service, gingers. And when you re lawyer application Now, when you click on the Zero button We're going to get these values right here. Very quick on this Riverton, you can see you have these values in the stable. So we have this book one look to publisher fun and publisher to vintage book Prize. All right, It's very simple. Now we know that how to create on re data from the reader is right. Now, let's see how you operate this data. 8. PHP CRUD 7: now just aren't that. Let's see how to operate this data. So what? We're going to do it. I'm going to just adhere, and I call. So when we click on this icon, I will display old state of his record in the state boxes. So when I click on this supposed text box eight icon, I would display this false record in the state boxes. Let me show you what we're going to do. So I'm going to just great here. New double data on gold. The idea here on specified class France If a edit on specify median, any class here, right? Saves INGE's and really reload your beach. You're going to get this idiot icon, right? So now when I think understated icon, I want to display this force Raw data in this take boxes. So I'm going to get the help from Joe Escape to do this work. Right? So what? I'm going to do it. I'm going to just create here a new file off jobs Girl on named this value main dog. Jess, I'm going to force include this file in indexed art piece re right here. I'm going to create here a script on in the source Attribute off This craved I will specify crude the H B and main dog Js file Save the gingers on in maine dot Js file Now, in this means or Js file I'm going to create in men on these icons. I'm going to just call dollar sign to call the Jake. Very object on in the double coat. I will just go BD en credit class to select these icons, right? And just create here click event on this click event. I'm going to specify a function, so I'm going to call arrow function here right now. In this function, I will force a console dot long and just bring a man Sage icon clicked. Right? See what the changes And on the console right here. You can see a message when I click on this icon. No, just offer that. Get rid of this console message. What? I'm going to do it. I'm just going to create here a function on name dysfunction display data and space If I even as a perimeter No, I was just great here. A new available. So just a leg. I d is equal to zero, So I was just disappointed Report value to this party. Then I would call Constant table data is equal to just select this table Data is dim attacks. So I'm going to just say here, using the dollar sign using the Jake ready, I'm going to just select this. They will data. So I'm going to just call the Peabody. I d able to go and select this table data. Now, we know that we have this table data in these dd variable. Now, what I'm going to do is I'm going to just create here and Eddie on, get an empty out of here just after that and just great here for a flu. So I will just say for on just say here constant value. Oh, did he? And just bring this DD on the console like this before Just to hear console dark. Long on. Specify this value on when I call this function right here. Display data like this. If I reload the application on click on this icon, you're going to get this ditty table data on the console right now. We know that you have the stable data in this value label. I was just open my index start appears before you onto this table data. I'm going to specify that I attribute to this table data, So I would just say here data I d is equal to I'm just call a bit rescript here, so we'll just stay here, BHP All right, now what? I'm going to do it. I would just call this equal state man right here to identify this table data using this idea. So just called his equal row. I d. Right. I will do the same for all this table data like this. If I just copy the statement on specified this to this table data to this table later on toe this table data, right? So you could gingers when you read or your application. You can see right so you can see we have this data attribute to these table data. Now, let's see if I want to grab second record values in the state boxes. Then I will just say if the table data has table data, I did too. I want these values. So this will return all these values. Let me show you what we're going to do now in Main Door, James, while right here. I'll just get rid of this control. Not long are any part just to hear e value dot Did I say it? Not i d. So you can access this data state idea using data ST dot i dy property right is equal to two. I want to bring all this data on the console. So if I just stay here consoled out long on space If I value here, I'm going to get the second record on the console like this. It was Just load this application on Click on this, Eddie gotten. I'm going to get this second date of his record on the console. And if I want to get the force database record, I will just change this 2 to 1 when I reloaded. If I click on this icon, I'm going to get this forced data record right now, Instead of specifying this hard core value here, I would just call here even perimeter dot target dog data said not I d. So this dead man will return the I d off these icons So this dead man will check if the idea off this icon is equal to this data's already then this will going to return this specific Ricard like this If I just bring this I d If I just stay here, consoled our dog And if I just sit here e don't target dark later. Say no, I d. And if I reload the application and when I click on this post it, Burton, I'm going to get here boots. I need to specify here before I call this function. So I was just basic fly here e on some of the changes. And when I reloaded and now when you click on this idiot icon, you're going to get nothing, because this basically this data tribute to this table data back on, we're accessing the stable data. I d off this icon. So I'm going to just get it off the statement on a specified do these icon right here say the changes. And if I reload the application on click on the edit button, I'm going to get this value. So when I click on this first I d. I'm going to get one here with these databases record. When I click on this, second recalled, I'm going to get to here with these second values, right? So in the vein dot Js file I will just get rid of this console on internal printing All these values on the console. I'm going to store that in the area in this area. Right. So I will just say here text value in the eddy on specify idee here. I'm going to increase this value by far. I just specify value dog text content, right? So I'm going to store these values. These values this takes contend in this added on, just return it. So I'm going to just stay here. Well done digs values. Now you know that this function is returning, Inari. So I'm going to just get this atty right here so I'll just stay here left, takes values musical to and just get this adding in this variable, I'm just brain dead like this. So if I just sit here, console dark long, I bring this values. You're going to get Ari off data, right? Do you have one book? One publisher, one on the value off the post record. We've actually going the second record. You're going to get an ari off second record like this right now. I would just get it out this control on. Just specify this values in this. Take boxes. So I need to force select the state boxes. So is in Jake. Ready? I'm going to just select the stage boxes, so I'll just stay here. Input on. I'm going to select all these tick boxes using name after built. So just a here name. Specify Estrich. Your and right here. I'm going to say book I d. Right. So I'm going to access the stakes. Balked using name after girl. All right, I'm going to store these take walks in the valuable time. Just elect Heidi. Corporatist it, man breasted here. June is reliable to book me on. Just drink this, Heidi. Dual name. Copy this statement posted right here. James is valuable. Do book publisher on this name Began Book publisher Christie again. Justice variable to book Price changed his name. Do a book price Now. The space if I value do these dicks boxes using dignity, you can use value myth her like this. Now, if I just call here like this, I d dot row. I can specify value to the dates box right now. If I just call here Val and if I just sit here too, on reload the application. And when I click on this icon, you're going to get to in the state box like this, right? So he's involved. Method You can specify value to any date box. Wasn't Jakkrit All right? So I'm going to just basic fly here takes values. Zito. Right. So I want to specify the force index off Paddy to the stakes boss. Then I will say book name dot Well, and I want to specify it takes values off one and I will say book publisher not bow. I will save book values. Do book price north around X values three. So here. We're going to specify this Addy one by one to this. Take boxes, sir. Vision juice. Download this application again. When I click on this icon, you're going to get these values in the states boxes like this, right? So now you can update these values by clicking on this button easily. So let's see how to update these values. Now. What I'm going to do is I'm going to just open my operation Dark patri file. I'm going to get this data on update their data integrators like this. We played just great here. A function on call dysfunction update data. If I just specifying a comment here of date data on call dysfunction on on tick event off this button like this. If I just create here Eve, he said call this post on just call of date. But in here, I'm just here of date data. So if I just call this function on this button trick event, I cannot read this data like this. Now, the opportunities data, you need to post get these values in the variable. So I'm going to get these values. I would just say here, book I d is equal to just go on textbooks value function on. Just stay here book. Heidi. So this statement is going to return the value off the state box right now. Just talk that I would just say, Look, me is equal to x box value on Just stay here. Book name than ever. Create a new variable book publisher. Just say export value. Just basic fly book Publisher on the last, I will create a new variable book price on Just call takes value and just call here book price. So now we have the steak box values in this video votes. So what I'm going to do is I'm going to just call here and now I will just say here if the book name the book publisher on a the book price. If we have data in this variables, I'm going to just execute this. If block are just executed, these it is about all right in this block, I'm going to create a school statement, So just great here, a variable is grill on. Just call here a school statement like this if I just stay here of date books. So I'm going to specify the name off my table, and then I will say set book name is equal to the single code. I won't go this book named Variable. So just to hear book name, right? So I want to specify book name value to this book Name filled. All right, now, I'm just start with that speech by coma here and just say, book publisher physical to in the single court. I will just call book publisher Facebook. Com A here on just say book price is it will do in the single goat. I would just call book Price and just talk to that here. I would just say very cause where I d is equal to and in the single coat. The idea is going to be this valuable book RD, right? So I'm going to pause thes Bacardi valuable here right now. I would just execute the statement, so I would just call here if my is girl like, Gritty, call the connection string. So we just call here Global's connection, and then the second argument is going to be their school statement. So we just call a Skrill here. If this statement is true, I'm going to just call takes note function, specify the class name. Jeez. Success specify the text data successfully updated. So we're going to call this takes nor function, which we have created of here right now. Just talk that if we don't able to insert this data, I'm going to just basically here. State man on display is dysfunction again. Jeez. Disclosed to enter on this message is going to be unable. Jew of date data Right on in this l statement right here. I'm going to call the sticks known with the inner message on space if I hear select data using and it Icahn, right? Saved genius on when I reloaded application. And if I click on this 80 per ton, I'm going to get this data in the state box like this. All right? I won't between this book price, So I'm going to just change these. I'm going to just change these 2 45 right? And if I click on this update button, this will update this value. You're going to get this message data successfully updated. If you click on the street, we're done. You can see you have this update it value. But now I want to space for a dollar sign. So this book price So what I'm going to do is I'm gonna just spoke on the index star base before oil on right here. I'm going to just adhere dollar symbol like this. All right, don't forget to specify dot Here two concurrent these values save the changes. And if you really love your application, you're going to get these dollars in ball right here. If I click on this icon, you're going to get this dollars a ball in this. Take a box as well. I don't want this dollars involved in the states. Well, so what I'm going to do is I'm going to just open my main door Js file to the state box Rather's three. I would just call here the place dollar to industry. Right. Say the changes and click on this icon. You're not going to get this dollars in mall right here. All right, so it's easy to update this value. Not now. Let's say I won't operate the second value. So I'm going to just click on this icon on. If I just changed these 33 to 40 on, I want to change this publisher do this year 23. And if I click on the submit button, you're going to get dismisses. Date on, successful. Updated. And when I click on the suit, we're done. You can see you have these publisher 23 44 99 9. PHP CRUD 8: Now we know that how to create really and update data in the database. Now we're see how utilities data using the state person. So I'm going to show you two ways to delete this data using manually on by pressing delete all button. So let me show you first how to deal with this data manager. So if I just click on this 80 button, I'm going to get these values in the States boxes. And now, when I quickly distillate button, I want to delete this particular record. So what I'm going to do is open my operation or patri file on right here. I'm going to create a new function on name dysfunction. Dilate record. Right now, I'm going to call this function, So I will just say here if he said and just call the button right. So I'm going to just to hear post on specify the name off my bottom. So just to hear Bill it. So when I click on the deal button, I want to execute delete record function right now in distribute record function, I'm going to first get the value or the first take pops. This one, I'm going to get this idea first. So I will just create here a new variable book I d is equal to on just call text rally function which we had created earlier to get the value off the text box and then specify here book I d. Right. But now if you take this value, return from this tick box is going to be a strength because the text box always return straight. So I don't want to get the strain. So I would just convert the string until integer So I'm going to call this parentis is here on say here in teacher. Right? So this state man will convert the extreme value toe integer and story in this video. Right? So now if we have to hear this is going to be store to here with the type in teacher, right? Just tougher that I'm going to create here at school equity. So just to hear Ehskyoo on, I'm going to create your delete from books, right? So I would delete record from this book stable and now we call where costs I was just here where I d is equal to you and then specify this variable. So I'm going to call here book. I d fine. I want to delete a record equal to this I d. Now to execute the statement, we just need to say if my SQL like, ready called the connection variable. So just say Global called the connection here, Then in the second perimeter, I'm going to pause the gritty right now if Dysfunction returned to I'm going to just print a message so I'm not going toe equal anything. Instead, I will just call takes note function, which we had created earlier. So the force perimeter is going to be the class name. So I'll just place if I hear success on the message of a God deleted successfully. Right now. If this function is not able to delete this record, I'm going to print an error. So I'll just say, else here on in the text mold, I will just base if I the middle class on the message, unable to delete record, right, say login jays and just execute your application. Now let's say I want to delete the second a car, so I'm going to just select the second record. Usual this edit button on don't believe this record you just need to click on these billet Britain. So when I click on this jelly button, we're going to get a message er recalled, debilitated successfully. And if you repress your database, I could go on this road. Wharton, you can see here you have only one record. Now, if I tried to insert a new record on Named is Book three, publisher three and the price is going to be 54 point. And if I create a new record and when I repressed the batteries, you have third record here, right? So as you can see, the second record is diluted. Now, let's say you have more contained records in your database, and you want to treat all of them in that situation. This technique is not usable. So I'm going to create here a new button to delete all the records in my database. Now what? I'm going to do it. If I have more than three record, I'm going to create here. A button on named is Burnin. Deal it all on. If I have less than trivia card, I don't want to create this button because I can matter. They're deleted all the records one by one. So I'm going to just create here a function in this population dot PHP file. Now, to create this button, I'm going to create a function because I want to our condition in that function. So I'm going to create here function just to hear delete obedient. So this is the name of my function on I'm going to use this function to create a better I'm going to first call, get data function. So this get data function, return the result off the leaders it So in the result variable, you have the data state values right now. Just after that. What I'm going to do is I would just say here if we have values in this result, I will just a viol rule is equal. Do my ask your life rich associative body on just specify result here. So this fun generally turn associative array to this role. And if you have this ari in this row variable, I'm going to get the I d. From this result. So here, if I just say equal on just say rule i d. Then I have here I d in this valuable. So I have here three in this radio. And now if I execute this function, I'm going to get three on this document. Right? So what I'm going to do is I would just get off this Geico state man and create here on the variable I on space if I value to it. So just specified. Zero the default value on if I just say here I plus plus, So this will increase the value off the I buy one on just to hear if the I is greater than three. Now, here I'm thinking that if the table records is greater than three, then I want to create a new button here. So what I'm going to do is I'm going to just say here but an element I would call the button element function and then for specified the button i d. So I'm going to just basically here Bt and delete. All right, then I would just place if I hear the class name, then I will specify the classes. So just a here, Bt in beauty and danger on then I want to specify the text. So I'm not going to add in next year. Instead, I'm going to add and I can hear. So I will just add Here I go on on, specify class toe ad. I can hear on just to hear fast if a trash right on just offer that I want to add here a text delete, huh? Right now, just after space. If I comma here on, specify the last argument. So I'm going to just place if I hear the name off my button. So I'm going to say here, delete fall right on. Just after that, I'm going to specify the attribute. I believe this attribute as it is, I was just specify the double court here, right? I just After that, I will just say here, return to exit from dysfunction, say the changers. And now, just after that, when we have dysfunction, I'm going to just open the index dot PHP file I invite appeared just after this last button . I'm going to call a PHP script on Just call this function Delete began, All right, save the changers. And when I executed, something is going wrong. I need to inspect that year here I focus a specified dollar here Say that the dangers every news gilded you can see when I have more than three records. If I just killed here one more record name. Days. Book four publisher for Enterprise is 22 point 98. You've likely it here. A new record on if I just create one more record here on if I just take your book fire. Probably share of life on the crises 55. So I'm going to just create a new record here. Then you can see we have this new Britain here. But as you can see here we have undefined constant delete all so, as you can see here No, I need to specify double court here, save the changes. And when you executed, you can see you have to steal it all put on as well. Now, just after that, I'm going to just remove this marching and this planning from this button. So I'm going to just open this time Lord Caesar's file on right here for this. But, um, I'm going to just place if I'm margin 1.5 p m. On 0.5 p. M. On departing is going to be born 3 a.m. On one point for him, right? Say, with changes. And when you executed, you have your buttons. Right now I insulted few values in my database. So if I click on this read water, I'm going to get this stain values. If I want to delete these duplicates values, then I can click on this. 80 puttin on when I click with is still in Britain. This value is directed so you can see here we have record dilated successfully, massive. And if I click on this re Lord, you can see the seventh Addy is deleted. Let's say if I want to treat all this record at once. So when I click on this delete all button, I want to deliver all these records. Now what I want I want to delete all this a card. Now if you try to manually, it's like this record and dilated. You're investing your lot of time. Instead of investing your time, I'm going to create here, but delete all button. I'm going to create a function on this delete all button. So when you click on this delete all button, I want to read all this records. So what? I'm going to do this. I'm going to just open my operation, not psb file on right here. I'm good. Agree here. A new punch in on name dysfunction. The late Oh, all right. And this one, John, I'm going to post create a school creating so just secure a Skrill musical do. And in the double coat, I'm going to just say draw table and I want to drop the table books, right. And to execute this Grady, I would just say, if my this girl, like, gritty and just executed with the connections, I'm going to just call global connection. I'm just basic fyi, dsq Fatima here. Now, once we have this bad a meter, I'm going to just say, here, take snowed lands. Basically the class name, which is success on the value of this text. He's, um, recalls all the card, the league a successfully on just offer that in the statement, I'm going to say takes note space. If I class it er on, the message is going to be Something went wrong. God cannot delete it. All right? Say the changes on now, just over that. Just get here, Eve. He said specified the post on. Just call the name of your delete. All button. So I'm going to just sit here, the league. Oh, and in this state, man, I'm going to call delayed all function, right. Save the changes. And when I click on this gate on button, this will delete all these records. Let me show you, exactly contagion it all. Button. You're going to get this message all recorded it it successfully. But now you can see here you have this morning. So to solve this problem, what I'm going to do is when you delete all the record, I'm going to just create a new table. Once we did it all the record. So I'm going to just call. He had to be function here. Say that suggests on really lower your application. The warning is gone. Not if you click on the street, but on. We're going to get nothing because you don't have anything. Now let me insert a new value. So I'm going to say Here, look one, we'll be sure one enterprise is going to be 76 or 99. And just insert this value in the little ways. Let me show you. All right, inside the next value. So I'm going to discrete on these. A reporter. Jane, This book to two or leisure to on the value is 16.99. You've actually called escape button. I have my second value here. All right, but as you can see, you don't have this delete all button yet. So if I just create my told value like this three, publisher three on the value is going to be something like this. You're not going to get this straight on button. But if you create what more free card in this table, you're going to get this button right here. In fact, we clean, discreet, but done. You can see you have this digital button because you have more than three records right now to deal. It is all recalls. Just click on these data. All button, chronically congested. It all button. All record is successfully deleted and you don't have a data in your table right now. Now, the last thing we need to do is I want to specify the read only property toe. These textbooks on also want to space for the value for the stakes box. So what? I'm going to do this. I'm going to Just when my main RJ's file. I just got this idea statement this one posted outside of these function. So what I want to do is I just want to specify read only property toe deciding so user cannot change this value because the idea value is unique. So that is why we're going to just specify it only property to this idea. So I'm going to just here I d attributes. So I'm going to just call the attribute method of dignity and justice if I read only and the value is going to be read only. All right, so we knew it, secured it. You can see the anything box is now read only. So now you can change the value of this idea. Now I want to specify the i d in this text box. So let's say if I have two records in my data ways, I want to just play here three because we're going to insult it. Did told Ricard. Right? So I want to space for here. Three. If I have two records in my database now, let's say if I just create here to records, I'm going to just take your book. One publisher, one on the price. So this is my first record on this is my second record, right? But I have two records in my batteries. I won't space for three here because we're going to insert our third value. What I'm going to do is I'm gonna just open my operation dot PHP file. So I'm going to just create here a new function. So it is a function. Say it. I d. So I'm going to just great here, command on just to hear sake. I d do textbooks. Now, in this function, I will just first get the i d. From the get data function. So what I'm going to do is I would just call here, get idee is equal to get data. All right, so this gate data function is going to return the result. So we know that we have this result in this get data. I debatable. Now, just after that, I'm going to create here a new valuable call. I d Easy will do. Zero. So this is the default. I d. I want to specify when I don't have any record in my table. Just for that here I would just if I have anything in get later and get i d I'm going to just call while appear Just a vial called it all on Just say here my ask your life fridge associative Ready and just raise If I hear Get i d When you have this adding you can get the i d So to get deciding Just call this rule then call this idee using single gold like this on stored his i d in these already variable So I'm going to just call here i d right now. Just talk that just after this if statement right here, I'll just say return I d Now, if you return this idea, you're going to get to here because I have two records in the table. I want region tree because I have two records in my database table. So that is why I will just add here one. I'm going to get three here because I want to insert find third value. So the gingers I call dysfunction indexed our peers refiled right here for these book I d value. Right? So I'm going to call here set I d say the gingers when eggs good this application you will get to hear, Frank, because you have to Values in your data weighs on. You are going to insert your tote value. Not if I just delete this value. The second value like this you're going to get here to because you have one value in your data breeze and you're going to insert your second grab You. So you know that homely course are there in your data. Raise on on which, Heidi, you're going to insert your next record. Right now, we know that how to create treat home plate and deal data using PHP. It's very simple. So that's it. If you have any questions, you can ask me any time, that is all for now. I will see you in the next tutorial.