5. Food Order Website with PHP and MySQL (Add and Display Category)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone i am tapa and welcome back to the new episode of our food order website with php and mysql and today we will work on category model so without further ado let's start our tutorial [Music] so i will go to my food order website admin panel for that we will have to go to localhost last food order local slash footer is our home page whereas slash admin is our admin panel and as soon as we go to admin panel uh since we have added authorization in our previous episode uh this will ask us to log into our system so i'll log in with uh username and password that we have set in previous episode i hope you remember the username and password so my username is admin and password is admin and i'll press enter to log in and i have logging successfully so i'll refresh it our message disappear and today we will work on our category model so first we will work on add category and then later we will display the category that has been added in this table so let's work on our ad category now i will go to our code editor which is busily studio code and here is our code and uh this is the login check uh file we created in previous episode we do not need that right now so i'll close login i'll close menu i'll close log out and i'll close index.psp as well now along with our ad admin and other pages we need to create our ad category page so along with our add admin delete admin pages we will create our add category page okay so i'll click on new file and here i'll call it as add category dot php that's it and this is our category page and the first thing we need to add is uh menu so php include and then we need to get out of our admin folder get inside we don't need to get out so we just need to go inside part c else slash menu dot php and semicolon at the end similarly we also need to add footer so i'll just copy it and go down paste it here and instead of menu we will call it footer.psp and in the middle we will add our uh main content so i'll create a div with me main content class div main content and inside our main content uh first thing we'll have is d with wrapper class so div wrapper and inside this wrapper we will add uh our heading which is h1 tag and after heading we will add uh form to add the category so let's add the heading first so it's one and this is our i did add category page so this is at category page and after h1 let's add couple of br tags so one br and two beer i will add two br text and after break we will have form so uh add category form starts and i will copy the comment again and paste below that and i'll call it as add category form ends and before designing the category i will save it and i will link this category in our manage category.php page so i will open manage category.psp and here in add category here i will add the link to our ad category page so i'll read this hash our pawn sign and here i will start php and i'll display our site url site url and then we need to get inside admin and inside the admin we have add category.psp and let's save it so i have just given the link to our add category.php page that's it so this is our link so let's check whether our link works or not so i'll save it by pressing ctrl and s and i'll go back to the browser and i'll refresh the browser and i'll click on add category button and here we can see our add category page so that means we have successfully connected our ad category.psp page but if we are getting either like a 404 or object not found error that means you have your link is not added correctly so follow the link or make the link like this and it should work now since we have seen that category page we will design our uh form to add the category so to design the form i'll look at the database and based on our database table we will design the form okay so i will look at the database localhost slash psd my admin and we need to get inside the database and look at our category table so here is our phm admin and our database name is food order and inside this food order we have tbl category and let's click on structure and these are our columns so id is primary and it is also auto increment so we do not need to pass the value for id other things we have we need to pass the value is for title image name feature and active uh featured and active uh will be a radio input type uh title will be of welcome our input type text uh whereas image name will have button and we will select the image and our physical image file will be uploaded into a folder whereas the name of that image file will be saved in database but at first we will work on adding data like title feature and active and after we added this feature like title feature and active then we will upload the image and also save the image name so let's design the form with title feature and active okay so let's go to add category.psg page and inside this comment uh we will create a form and action will be blank because we will be processing the form in same page and then method is equals to post and then inside this form we will create a table to design or align the uh form up nicely so i'll create a table and the class for table will be tbl 30 if you remember our previous things so class is equals to tbl dash 30 and inside this table we will have tbl row and tbr rtd so here we will have row tr and inside this row we will have td td and first thing we need is title or this is the category title so if we sorry ti and if we check our table the here we have our title and at first we will save the value for title feature and active and later we will also upload the image and save the image name so for now we will uh create input field for title feature and active only so i have created a title name and let's create another td for our input type input inp input and type will be text and let's say name will be sorry not here here name will be uh title and its placeholder will be placeholder is equals to category c a t e g r g uh category title title title that's it let's save it and let's go back to our browser and let's refresh our add category page and here we can see input form for title now let's add input form for uh feature and active okay so let's go back to our tr after tr we need to add another tr and here i will add another tr t tr and inside this tr we will have td and the first one what do we have we have feature so let's say feature fat you are already featured and here we will create another td or column and here uh for feature we will have input type radio so let's create uh input type is equals to radio and name let's give name is equals to featured and we need to give the value for this one value is equals to let's say yes and here we need to give the title or label outside the input tag as well so this will be visible in web but this value will be saved in database and similarly we will also need to create another one for no so i'll just select it and copy and below this i will paste it here and for both of them name will be same so this is featured section so the name will be featured and feature but value will change so it will be no and this will be no so these will be displayed in browser and this will be saved in database okay so let's save it and let's go back to browser and let's refresh and here you can see radio button and you can only click one of this either as either no so this is featured and we will create similar for our active so active and let's go down here and after tr i will call it tr and here let's create td and if this is active and let's create another td and here we will have input type radio and name will be active and value will be value is equals to yes and outside this input tag we also need to add yes and i'll just copy this and copy ctrl c and after this enter and this will be no and this will also be no that's it let's save it go back to browser and let's refresh that's it now let's add a button to submit this form first we will save this value and later we will also upload the image and upload the physical file of image as well as save the name of image in our database okay so let's add the submit button so after tr i'll create under tr and here i will create td and i'll also add a cool span of two because we are merging two columns and here we will add a submit button for that we'll use input tag and type will be submit name will also be submit and we'll add value is equals to let's call it uh add category and let's give it class as well so plus is equals to btn dash secondary that's it let's save it go back to our browser and let's refresh the browser and here we have our button now let's work on saving this data into database so let's go back and and let's add the code after uh form i will add the code after form here so i'll open php and first thing we need to do is check whether the bottom submit button is clicked or not so check whether the submit button is clicked or not and we will only process the form and save the data in database only if the submit button is clicked so if it's set dollar underscore post and submit then only we will process the form so let's check the value with echo and clicked so if the button is clicked then this message should be displayed so i'll save it go back to browser i'll refresh it and i'll click on add category button and here we can see the message that's means that means our ad category section is working successfully so let's go back and let's add this message and the first thing we need to do is get the value uh from our form so first thing is to get the value a value from form let's say category form and the values we are getting are uh title feature and active so let's get the title first so dollar title is equals to dollar underscore post and we are passing the value through post method and title and for input type text uh this is okay but for input type radio and input type check we need to check whether the value is set or not so for radio input type we need to check whether the button is selected or not because sometimes while uh filling the form user may not select either of these so if we do not uh check uh whether the button is selected or not then we might get error so to make our form processing error proof we need to check whether uh this button is clicked or not so for that we need to check it so if if it's it dollar underscore post and first one is featured feature if button is selected then we will get the value this means if button is [Music] selected then we need to get the value value from form else set the default value so here we will get the value from form dollar featured is equals to dollar underscore uh post and then featured and if the value is not set then we'll give the default value and dollar featured feature will be here we'll pass a string value and feature will be no okay so and the value must be same as our form here so either of this so value should be like this no or why yes yes and for default we are giving no value for our feature and similarly for our active as well so uh if is set dollar underscore post and then st if active then we will get the value for active so dollar active is equals to dollar underscore post and then active but if the value is not set then we'll give default value so here we'll have else condition else dollar active is equals to no that's it let's save it so hope you understand if you have any confusion then please comment below i'll try to make you understand in as easy as possible way okay so we have successfully obtained the value for our title uh featured and active now we need to create our sql query to insert uh this data into database so second step is to create sql query to insert insert a category into database so dollar sql is equals to insert into insert into tbl underscore category set and here we will set the value for our column so first column is title is equals to dollar title and then feature is equals to dollar feature and then active is equals to dollar active that's it for now uh when we add the functionality to upload the image then we will also pass the value for image name for now we are just passing the value for title featured and active that's it now after that we need to execute the query so three execute the query and save in database so dollar raise is equals to mysql mysql i underscore q uery and here we'll pass dollar database connection and then dollar sql that's it and since we have added the menu menu already has constraints.psp so we already have dollar connection database connection and after that we need to check whether uh the query is executed successfully or not and data is inserted or not so let's do that take away the the query execute it or not and data added uh not so if dollar raise is equal to is equal to true true a true then uh query executed and category added else fail to add fail to add category so here uh we need to set the session message uh and display the message in our manage category page and redirect it to manage category page so let's create a session variable and set the message i would call it as add and we will pass the session message and uh to color our message let's create a div tag and deep class will be success and then we need to close the div as well and between this div we will call the message or set the message and it will be category added successfully successfully and then we need to redirect it to our manage uh category.php page so redirect to manage category page so to redirect we use header and then location and we will give the url with site u r l site url and then slash manage dash category category dot psp that's it so this will set the session message and this will redirect us to manage category.psp similarly let's set the message for our fill catfill to add category so i'll paste it here and this will be class will be error error and the message will be fail to add category and here instead of manage category here we will pass uh or we'll redirect it to add category or same page so let's save it and let's display the session message so first i will display the session message in same page whenever it failed fails uh to display the field to add the category in database so after this br here i will check with php and between these we will check whether the session is set or not if it's set dollar underscore session and session b arrival is add then we will display the message echo dollar underscore session and session variable is add and then we need to remove the message as well once it is displayed so onset dollar underscore season session name is add that's it so this message will be displayed uh when we fail to add the category but we need to display the message on a category edit successful as well so i'll just copy this and i will also add br tag after this php so here i will add vr and vr and then i'll copy this php start and php close ctrl c copy and let's get to and let's go to manage category.psc file and at the top uh what should we after this uh br after this br let's display the message so i'll press enter and paste it here control and v and we have our system message and after session message i will add vr tag as well so that's it let's save it and let's go back to our browser let's refresh the browser and here i will try to add the category for now i'll add it as p i j jt pizza for category and i will add featured as yes and active as yes and i'll click on add category and category added successfully and let's go back to our database and i will click on browse and we should see the value so here we can see the value title is pizza id1 title pizza featured is yes and activates s we have not passed the value for image name so image name is blank soon we will also add the value for image name when we upload the image for our category okay so that's it we have successfully added the category in database now let's work on another thing which is uploading image for our category okay so let's go back to our code so i'll go to code view and let's go to add category.psp and here along with feature and active after the title let's add another row to upload to add a button to upload image so i'll create a row called tr and inside this tr let's add button td and i'll call it as image select image select image and i will create another td td and here we will create a input type of file type so input and type will be file and here we also give we need to give the name name is equals to let's say image and that's it and let's save it by pressing ctrl and s and let's go back to browser and let's refresh the browser or let's click on add category and here we have our button which choose file button and whenever we click on it and select any image then we can open it and it selects the image but it will not upload the image because we have not added the functionality to upload the image so let's go back to our code view and first thing we need to add is along with method is equals to post here we need to add ink type e and c t y p e is equals to uh multi part slash form data that's it and let's save it and this property will allow us to upload file or image so you need to add this property in your form tag okay so just adding type is equals to multi part multipart slash form iphone or miners and data data form that's data okay so that's it now let's go to our uh form uh processing section here along with our uh getting the values here we will check so after active and before sql query here i will check whether image is selected or not so here check whether the image is selected or not and set the value for image name image name accordingly okay so here uh what we can do is at first to check whether image is selected or not let's display the value whenever we select the button or whenever we click the button and select the image so here i will what i will do is uh print underscore r and then dollar underscore files so that's it and here i'll add semicolon and i do not want to upload uh or save the value in database so i'll break the code here and i will add die to break the code uh break the code here code here because i i just want to see the value of file selected so instead of echo i have used print underscore r because echo do not display the value of array and dollar underscore files is a array we need to use print underscore r to display the value of array okay so since this is the input type file this is input type file we need to use dollar underscore files okay so this will display all the data of our file selected file so let's go back to our browser and let's refresh it and sorry i cannot use okay here we need to pass the name of the file so name is image because uh here if we go here this is input type file and name it image okay so i forgot to pass the name image for other type we also have name so we need to pass the name okay so let's save it let's go back to browser and let's refresh it and here we our error is gone so i'll select the image by clicking on choose file and i'll click on one of the image and when i click on add category here we can see the value of our file selected so it has a name image has a name and type and tmp this is the location okay location of our file tmp is this is the location of our file so that's it okay so we will use these things to check whether uh the file is selected or not and we will use uh this dmp underscore name uh to get the image and upload in our project okay so let's go back to code view and let's go back to form processing section and here i will just remove both of these or you can just comment it out and i'll comment it out here as well so here we need to check whether our file is selected or not okay so for that we'll if it's set dollar underscore files and we need to give the name and inside the name uh not this is not name this is image image is the name image is uh the name of our file type so image is the name of our file type and here after that we need to give another square bracket and here we will select the name okay name property so if you if you see here we have a name property as well so we will select this name property and if this name property is not empty which means it has if it has a value then we will upload the image uh else we want to upload the image okay so if our input type file uh whose name is image has a name value has a name and it has a value then only we will upload the image okay else don't upload image and set the image name value as blank okay so here i'll create a variable dollar image under school's name and i'll set its value as blank okay so that's it so we have our image name variable but its value is blank but after uploading the image our image name hello will have its name okay so this is our image name so we'll set this image name okay so here we need to get two things to upload the image so to upload the image we need uh to upload image we need uh image name and then source path and destination path okay destination path and here we also have our images folder so first let's get the image name so our image name will be dollar image name is equals to dollar underscore files and our file input type file name is image and then we will get name okay so we are getting this value name value so name and input type input type name is image so here input type input type file name is image and we are getting its name okay so image name we are getting image name and let's get the source path so dollar source path is equals to dollar underscore files and then image and then dmp underscore name okay so this is our source path so here if you see tmp underscore name this is inside c xampp tmp so this is our source path okay so this is our source path and then we need to give our destination path also destination underscore path is equals to double quote and here we will keep the path okay so let's add some space and uh we will upload the image inside our images folder and inside this images folder let's create a new folder i will call it as category category and inside images folder we have category i will minimize it minimize it so that's it and right now we are inside our ad category page which is inside admin so to upload the uh image inside our images folder inside category we need to get out of this admin folder and get inside images and category okay so here to get out of this admin folder add to full stop sign slash and then images folders and then we have created category and then we need to pass our image name okay so this is our image name we need to pass this so to pass this i will concatenate it so here i'll add fully stop sign and then dollar image underscore name okay so that's it so this will have source path this will have destination path and this will have image name as well so here now we can upload the image so finally upload the image so i will create a variable called dollar upload and we will add a function called move underscore uploaded file so this is the function to upload the image and here we need to give our our source path and destination path so first one is dollar source path and then we will also give dollar destination path okay so that's it and we will also check check whether the image is uploaded or not so let's check and if the image is uploaded and if if the image is not uploaded then we will stop the process and redirect with error message okay so let's check if dollar upload is equal to is equals to false then we will state a session message set message so dollar underscore session upload i'll call it as upload and this is the error message so i'll create a div divd close div and let's give its class as class is equals to error and its message will be fail to upload sorry fail to upload image that's it let's add semicolon and then we will redirect to add add category page relax to add category page so header and then location and here we will have we will pass site url dot site url and then we need to go inside admin slash and category dot php and then what we'll do is we will stop the process okay so why do we need to stop the process if uh we fail to upload the image then we do not want uh the data to be inserted into database that's why we need to stop the process okay so to stop the process we'll use die and it will stop the process and since we have already added the value for image name whether it's selected or not now we can pass image name in our database so here i will add image underscore name is equals to dollar image name that's it and do not forgot comma and let's save it and we need to display this message as well so i will add this session message in add category dot php on same file and let's go to top of at category page so this is at category page and here along with add we will display that upload message as well so here this is upload upload upload upload let's save it and this message will be upload uh this message will be displayed uh whenever we fail to upload the image okay so let's go back let's refresh the page and here let's add category title as test uh image and let's uh let's select the featured active as yes yes and i'll choose the image i'll go to desktop and i will choose this image and open and image is selected i will not add the select the add category first i want to show that our category folder is empty now let's click on add category category added successfully that means our image must be uploaded and our data must be saved in database okay so let's go back to our phd my admin and i'll refresh uh the table and here we have our image name we have our title test image and image name is our image name and we are featured and is active so all the value are inserted in database again let's go back to our category and image is also uploaded here you can see updated image inside category previously there was no image inside category but now we have category so like this you can upload the image in php okay and we need to work on another one thing while uploading the image so while uploading the image uh we are setting the image name as its default name so default image name and whenever we upload uh the same image again then this image will be replaced this image gets replaced and we do not want that for that what we will do is we will uh auto rename the image while uploading okay so after this image name so let's work on uh like renaming the image okay so here we will create a section to auto rename our image so auto rename in our image so first thing we need to get is get the extension extension of our image and extension are like jpg png gif atc and usually our image is our image name are like food one dot jpg right so jpg so our food our image name usually are like this food one dot jpg and what we want to get is our extension like what extension do we have jpg and for that we will use uh explode function so let's create a variable called dollar ext means extension and we'll use explode function and we want to get we want to break our full image name by this sign dot fully stop so we want to break uh this into two parts so when we use explode function then this will break uh the name uh with that sign so if we have like special dot food one dot jpg then it will get three different things like special one food one will be two and jpg will be three but for now uh we will so we'll break using dot sign so here we'll pass dot sign and then here we'll pass our image name so we are breaking the image name and since we are getting uh the extension and this extension is usually at is at the last of the image name so what we can do is add the end here and this will get our last value only okay so this will get jpg for us okay so here uh what we can do is we can rename the image now so rename the image so i will call it now dollar image name is equals to we can give our own name so i here i will give as food underscore category category and underscore again and here i want to pass random values i will add a random rand function and here we will give minimum value so 0 0 0 will be minimum value and our maximum value will be 999 and again we will concatenate and here we will add dot sign so dot and at the end we will add our dollar e x t okay sorry dot dollar e x t that dot exe so that's it okay so hope you understand it what i have done is so this is the image name so this image name could be special uh food let's remove this one first i'll remove this one for now so our image name so initial image name could be specialfood1.jpg and we will break this image and get the extension on this so for now we are getting the extension only and then what we are doing is we are giving it's a new name so this was the initial name and now what will what our image name will be is like this it our new image name will be food underscore category category and this random value will generate a random number between 000 and 999 so it could be like 8 34 and then we have added dot here so this will add uh fully stuff and then our ext so dollar extension will get the extension of our initial image so and it will add jpg okay so this was the initial image name so this image name who could have image name like this but final image name will be our foot underscore category underscore 34 like this okay so this is how we rename the image okay so this is initial image name and this is final image name and this image name will be saved in our database okay so hope you understand i will save it and if you could not understand uh these steps then please let me know in the comment i will try to make you understand and uh i'll try my best to make you understand in as easy and as simple as possible way okay so i'll save it and go back to the browser and again i will add another category so i'll click on add category let's add a test uh two let's call it test two image and let's for this time i'll select no and i'll select and choose image and i'll click or i'll select another image i'll click on this one and i'll click on open i'll click on add category if you remember the image name is donate cta new site.jpg okay i'll click add category category added successfully i'll go back to our browser or phpmyadmin database i refresh the database and here our category or our image name is changed to food category underscore 336.jpg okay initially it was donate cta something now it's changed to food category 336 okay and let's see our category folder as well and our category folder has food underscore category underscore 336.jpg okay so this is the simplest way of renaming renaming the image similarly you can also add a date or time date time with this uh image name so that it will be unique forever uh so you can explore uh those things as well okay and for now that's it now uh we will work on uh displaying the image or displaying the category that has been added into the database okay so let's work on manage category section and display our category in table so let's go back and now we'll work on manage category.php file so i'll open managecategory.php file and here we have our table and here you can see our table but it has full name and username and we do not need this instead what we will do is we will uh display the title and feature an active value as well as image name okay so let's go back and let's remove this full name instead we'll as title ti title title and then another one is uh image and another one is not accents we need to add two more columns so first one will be feature and another one will be another one with active active and here also we can add 2td sorry i will cut one of them i'll bring it down ctrl v and save it and we only need one roof we can delete uh these two rows so i have this delete these two rows tr start tr end tr start and tr end okay so that's it and we only have one tier i'll save it and let's go back to browser and i'll refresh it and here we have only one value title image featured and active okay and let's change the name of this button else as well so this is update this will update category and build category so update your update category delete category save it go back to browser refresh so update category delete category and let's get the value from database and display in our table okay so for that after our first row i will start the php here and i will create a sql query so dollar sql is equals to select all from tbl underscore category and here uh semicolon so here i will add a comment uh query to get all category from database and after the query we need to execute it so execute query to execute the query we will get dollar raise variable and we will use my sqli underscore query and here will pass dollar connection and dollar sql that's it and then we will uh count the roots so c-o-u-n-t count roots so dollar count is equals to my sqli underscore norm underscore roads and here we'll pass dollar resource or dollar result and let's check whether we have a data in database or not so check over whether we have data in data database or not so if dollar count is greater than zero that means we have we have data in data base sorry else we do not have data so when you do not have data we can just display the message so display the message we are inside the table so we need to display the message inside table and inside tr so i will create a tr here so here we will display i will call it we will display the message inside table for that we need to break the php so i'll break the php and then again start the psp i am just breaking the php and starting the php again just to write html between this so we can now since we have broken the php and we started the php between this we can write html and here i will create a tr and inside this tr let's separate the php and html inside this here i will create a td and here let's create a div as well div of error class and inside this let's display no category added so that's it and we can also like merge the column s p a n is equals to let's count how many columns do we have we have one two three four five six we have six columns so we will merge six column and display the message no category added and let's save it and i hope you you understand it uh if you have any confusion then if you have any confusion then please let me know in the comment i will try to make you understand in as easy and as simple as possible way this was the part when we do not have data but when we have data then we need to get the data data and display okay for that we will use while loop so let's create a while loop and inside this while loop i will create dollar row and here we will use my s q li underscore faith underscore struck and will pass dollar risk so this function will get the data from database and save in our rf in our row which will be array format and this uh while loop will continue as long as we have data in database okay so here let's get individual data so our first data i'll get is dollar id is equal to download row and this row has our data in array format so that we need to access our individual value so first thing is id and this is the name of our column in database okay so here we have our database and this is the name of our column so we are accessing value using this column name okay so we need to access individual column name like id title image name feature active so here we have obtained id similarly let's get image name dollar row and then image name then let's say dollar feature is equals to dollar row and then featured similarly dollar active is equals to dollar row and then active okay so now we will display this data in our tr like this so to add the html inside psp i will break the php and then again start the psp and between this start and end of the psp i will add the html code which is this row so i'll just cut this row from here cut it from here and paste it here okay and uh we need to align them perfectly and i will push it inside so that's it so we have our first one is serial number so this is sn and second one is title so here i will display the title psp echo dollar title d-i-t-l-a okay i forgot to get the value from title here so i'll get title title is equals to dollar row and then title so we'll display the title here and second one will be title and then image and then featured and active so title and then this is this will be image so i will for now i'll just display the image name so echo dollar image name and then we can display featured and active so i'll just copy this php code ctrl c and between this td i'll paste it here and this will be dollar featured and here this will be dollar active active active so that's it let's save it and let's go back to browser and let's refresh our manage category page and here you can see the data like first one has pizza title test image test to image and here second one has our image name third one also has our image name but first one is empty because we have not added any image for first one and here we can see the value for featured as well as active now let's work on displaying the serial number so for that what we used to do earlier is here we will create create serial number variable so i'll call it a dollar as n is equals to one and assign its value as one and assign value as one and here we just inside the loop we just increase its value with one okay so here it will be echo dollar s and plus plus so this will always increase uh this value one which is one with one so it will always increase by one so let's go back to browser refresh now we have our serial number as well one two three okay now another thing we'll work on is displaying the image here and before displaying the image what we need to do is we need to check whether the image name is available or not and only display the image when image name is available okay and we do not need to or we can just display the message no image available when we do not have image okay so let's go back and inside our image name here i will add the space before and after and here i will break or bring the code in different line and here instead of just displaying the image i will just delete it and i will bring this psp in tag in new line and here what we will do is check whether image name is available or not so let's check if dollar image underscore name is equals to is equals to or let's say is not is equals to empty if image name is not empty then display the image else we will just display the message okay so here let's display the message so message will be ac echo let's call it now let's give that div as well and let's add the error class so i will give it deep class is equals to error sorry error and dip deep close and here let's add no image or image not added so this will be our message when we have not added any image and display the image when we have image when image name is available we need to display the image so to display the image i will break the php and open the php and between this i will write the code or i will write the image stack to display the image so img and here we can get src and to give the src uh we need to to display the image we need to go inside our images folder and set category folder so let's give php so let's give the link echo site url and this site to url will get us to food order website and we need to get inside images and then category so after that we need to get inside images less category and then we need to display the image name so here i will open the php again close the php again and here we will display the image name email them that's it for now i will remove this alt tag so that's it so here we have our source a link to our image and the link is so this will give our link to our website which is food order and then we need to get inside the images folder and inside category so we are getting inside images folder and uh inside the category and we also give we also need to keep the image name so here we are displaying the image name with image name variable so that's it let's save it and let's go back to our browser and refresh our manage category page and here you can see the message as well as you can see the image that has been added uh since the image is large is it taking whole space but let's give its fixed width so after uh the source here before our angle bracket i will give the width w i d t h width is equal to and let's give the width of 100 pixel so it's just 100 px so let's save it ctrl and s let's go back to browser let's refresh it now our image is small and looks nice if you want a bigger image then you can add the width as you like okay but for now i think this is good and when image is not available we can also see the message so this is it guys we have successfully added the functionality to add the category as well as display the category in our manage category section and in the next episode we will work on updating the category as well as deleting the category so thanks so much for watching and if you like this video then don't forget to like share and subscribe and if you have any confusion till now then please uh comment below i will reply and try to make you understand as soon as possible so i'll see you on next episode till then stay safe take care see you soon bye
Info
Channel: Vijay Thapa
Views: 27,382
Rating: undefined out of 5
Keywords: vijay thapa, software development, web development, programming courses, free courses, php, mysql, php for beginners, php project step by step, food ordering system, food order website, food order website with php and mysql, how to create food order website, php project tutorial, crud in php, insert in php, add data in database using php, display data from database using php, web development with php and mysql, image rename in php, learn php, php course
Id: _Sxo-ASOatc
Channel Id: undefined
Length: 71min 37sec (4297 seconds)
Published: Sat Nov 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.