CRUD with PDO and OOP PHP #1 - Create Database and Setup the UI

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome back to another video tutorial and in this video we are gonna create fruit application we're gonna create this using PHP and we are going to using object-oriented programming to create ax and to connect with database we are going to using video and basically the UI I create using bootstrap so let's take a look how this application work so in here we have a Korean post and I click the Create post you have the model and in here we can type in the title and the content as well so let's copy content in here and base here and the author let's see John Doe and we can add post in here as you can see when I clicked at post we have to post 3 in here so basically we can edit for every single post for example I want to add it maybe post 1 you can see in here after we have a John Doe right and we can update for everything in here with even title content and author as well the content I want to remove everything and I want to say content 1 has been updated okay let's when I click the update pose as you can see post 1 is going to be automatically doing in the index and we have updated in the content so and we can delete for every single pose for example I want to delete this post 1 and when I click that now post 1 is gone ok and I clicked it at the game post 2 is gone and did it again finally you have post is empty ok so basically this is what I'm what we are going create and for the first is I'm gonna show you how we create the Tita B's and basically I'm using my sequel rock bands of course you can use be happy PHP my admin and let's see a local holes let's be my heart min alright this is the interface for PHP my admin you can create a database in here it's so really easy to do that I know you have already know but it has to be my admin so in this video I'm gonna create the database using my sequel work pens which is a really good UI graphic user interface for my sequel and so let's do that we have for the default you have user call a root and the password is empty so the first step what we are gonna do is create a database so let's create therapies with name o P block okay so let's use the database which is o P block and now let's create table with name pose the first is ID and data type it should be integer and it's going to be auto increment and next it's going to be title title C for char and two fifty-five like it should be the body let's say for cha oh no the body we need to using tax [Music] alternate C for char set to 255 and last is going to be dead create it should be x down and for the default that's set to current and stuff okay cool and for the primary key let's set the ID right so let's run this update worked cool you have a green check in here which is everything's work so let's select everything from post all right so finally this is what we have five column and for every column is you don't have any fail you so that's insert value insert into post and to insert the title body and outer title put an altar and set date create for the value values for a tail let's see pose 1 and the body let's see this is one and for the outer let's at the John Doe and dead create let's set now just function so let's run that you have a green check in the button so that's so like everything from posts so now we have the data get closer out so let's close the database and you have to go to exam folder and go to heads detox and let's see oh very start okay this is folder what I'm creating my project so let's open invidious code I'm using this Austria code for text editor of course you can use any text editor you like right is the folder I have been created so let's remove everything because we want to start from scratch okay so there that is empty so now we have empty when i refresh right here now everything is empty alright cool so the first is let's create file call index dot PHP and create a folder let's close out let's create a folder called classes this is we we are gonna put every class in this folder and we're gonna create another folder called includes and finally let's create a folder again know what I'm doing this let's create a folder in root save to templates alright so let's go to a boostrap let's make it a little bigger so click the get started and what we need to do is just copy the starter template copy that and go to index and paste in here and save so reload the browser now we have hello world cool so in templates let's create header and footer so header dot PHP and footer cold footer dot PHP alright in index let's copy everything and pacing in here safe and for the scrip copy that and based in footer and let's go to header and let's change the title to fruit of course this PHP does both P and video all right let's you know I want to make it a little bigger so you can see very clearly yeah now let's create a class in here called container I want to put everything to container okay so for the div I want to put in the footer right here okay good save and close the footer and the index as well know the index is not so go to indexed and in very top in we need to open PHP tag in here what we need to do is require once required ones and we're going to looking for the template folder and file name is going to be header right and let's copy everything here and paste under in here and it's gonna be a footer right footer so now say I'll take a look what we have all right so basically have the same thing but the hello world is gonna push to the right side because we wrap everything in with a container right next is let's go to poster up documentation and let's see let's start for modal and click that alright so let's scroll down and this is what we are gonna using so let's copy everything and paste in here like so and save and go to the browser and reload now we have the model cool really awesome but now let's dings some let's change the text to create pools and you need to do next is let's change the target to add pose Moodle and pose Wystan and for the ID of course we need to set the same all right ID right here everyone that said to add pose why I'm post model ok safe and just make sure it's work just fine so let's reload and click that it's work cool but I want to wrap the button in the class center so that's great class with named Tex Xena so let's grab the button put in here and maybe that's something like that and in here what we need to do is create margin top and bottom we need to set five okay save and now reload in the browser this is what we have all right cool so next is let's change the title in here to add new posts new posts and for the modal body you don't need the three thought in here so let's create a forum in modal body so let's make comment it's gonna be formed input so let's create forum and basically we are gonna do is clearly create a forum group label we don't need the four remove that and first it's gonna be title title and let's create the input type it's gonna be tags and let's give a class in here form dust control to make that full width okay and let's give a name because we want to send that in the another page we're gonna create metal poles in here and we're gonna get the name so the name is gonna be equals to post title post test title hello all right and we need to create something like require in here okay so say if just for make sure it's work now you have a title okay let's cross that out so let's just copy and paste couple time and second I want to do is content and the name is going to be post content post content and the last is gonna be outer and this is going to be post outer so let's close that out and for the model footer we have to put in right but we need to put the model footer inside of form something like that and we're gonna change the type to submit and let's change the text to add posts so now save and see what you have now you have file content outer and closed and add posts cool so far so good so in here let's create a div it class a row and let's create our called s and B this 6o and let's create a card it's gonna be card body say that's five it's gonna be it should let's create that's five wait a class card this panel and site in here let's create post one ok let's create a paragraph with class car test tax [Music] setting here let's get Lauren and under a paragraph that's great heads had six with class car - subtitle and script attacks - mute we're gonna push the text to the right side so right all right in the head six what we need to do is just make that in line say outer it should be tuned oh alright and under head six we need to create a button say class the NPT and this warning it's gonna be for edit and copy and paste second is gonna be danger what a red color and text is gonna be delete all right so safe oh yeah we need to create a tool so let's copy that and let's change the title to pose - all right so now save and see in the browser we have post one and post - okay it's hard code it's not from database of course but this is for part 1 video guys in the next video we are gonna we are connected to the database so just make sure you stay tuned in my channel so bye
Info
Channel: Cand Dev
Views: 7,171
Rating: undefined out of 5
Keywords:
Id: ZtklLt_3t5c
Channel Id: undefined
Length: 22min 35sec (1355 seconds)
Published: Sun Jan 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.