How To Connect Flutter App to PHP MYSQL Server Online

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi about here in this video I'm gonna take a look at how to connect the water up my SQL Server online I've imported this HTTP package as you can see my prospect llamo here and then I see you all have this skeleton up ran up bar and a body okay so in this organ is a huge happen they were that in our body here we are gonna create elected to fetch the results from the database and then will displease in are up here if online say we are going to use could be triple zero web host you don't go ahead and sign up for free or login if you already have an account I'm gonna sign up for free and I'll be brought to this speech I'm gonna fill in my email and my password and repeat the password okay so I'm brought to this page which they give sent me a confirmation email so I'm going to open my move and verify you can see mine that I've been sent this message to verify I'm gonna click this okay so that email address by fine I'm gonna log in okay so once you are done with the final it will go to this page here I'm gonna click on this odd and then give full-size name we're gonna say like that my secure and then click on this create okay so I'll be brought to this page here what I want to do now is pick a database I'm gonna click on this project manager and come down to this debate Monica have this here I'm gonna click on new data be and now be exploited it'll be doing I'm gonna call it Plata and I'm gonna hit create okay so once this is done I'm gonna go here hit manage then go to fish Maggie then we have our database here gonna open it and then here I'm gonna create a new table my up you don't have three columns down here the first one's gonna be ID take him then last one of the 44 a heading and gonna be gotcha for the lanes and then the body shame okay the ID is gonna auto increment I'm just gonna go ahead and click OK and then save so once you've done you'll be having this new table with these columns ID heading and everybody I'm gonna do I have any set values into these columns I'm gonna go here and then I'll fill it all back up so you can also go here and write the query for my heading I'm gonna say and body so I'm gonna add more rows here okay so once I'm done I'm just gonna go ahead and then hit cool this value should be inserted into my table so the equivalence you can't just write out this query make you are cheap the same with us we're gonna go back to my table and here you can see I have this ID photo increments headers and then body now we need for now for here go back to the tribunal of Hispano you can see without this database name then databases and database host are gonna do this it obeys them in a database user can invoke how us to connect this database enough data and then to build outs we're gonna write a districts to write a pill is great you can just go up here go to file manager let it come to upload fast now see your reader get to this pin and then in this page you can add a new found a folder you can search through the I think can upload files so if you want add at five layers click this name provide a new order file then you create it but you should I will create a file here if you want to open if you just click on it then click on this and it you can also download the father becomes view the phone he lives for this tutorial and I'm gonna write our PHP scripts live I could not go into the vs code and write it there ok football game vs code I'm gonna work here ok so inside here create a folder called it's my DB and inside this give me I'm gonna create a new fun so the thought I want to place now be the father and I will need to connect today server I'm gonna open it connection PHP ok so inside here I'm gonna open and close PHP dogs then in here I'm gonna try to do something and if there's an exceptional catch this exception and let's do something so in here the type of conception I'm going to catch should be at PD do a section because it's us in here I'm gonna make a Valpo for the connection I'm gonna call it connection it's a new video so if I use my school I connect button this video is more secured so the first argument to be for hostname and then they hit a resonant and then the second one would be your database username then the last one will be a password so in order to get these I'm gonna go back out where I want I want the database manager okay you can see we have it appears mean then they thought this geezer and then host going back for the first part that will say my SQL host to be equal to the local host local host then unless one in this phase admins still will be even in it may motivated is this the name of a database expanded forget a new face for the second arguments we need to provide a database username so coming back here is our DB username exits here and then the password to do a check when you're creating it okay all right now we're gonna say connection and sex attribute and I'm gonna say P do it it's yard underscore arrow mode and then you also say video mode perception so once were able to connect successfully when I display something the screen connected also there's a problem while connecting well industry problem I just want to come down here and say show out the problem we're taking a mess with out of hate and then we guys want to show the collection but after killing the connection also to show a message that we couldn't connect to the database okay so I'm gonna go back to my server or manager upload files I'm going to go ahead and delete this one does then I'm gonna upload a new file take a look for da we have pi D D okay watching chosen just hit upload once it's here you can delete it from here so right now I'm gonna go here and click view okay and you can see I have an error on line 11 of my connection dot PHP file and now here can see I have this pose wrongly let me check if I have any other thing wrong here okay this is supposed to be semicolon let me see then I try to do this again okay now I have another hello this is not defined okay so I have this spots wrongly put motifs then save and close let me try to do this again okay so you can see we have yes connected here now what I'm going to do is go back let me close this and close this as well and go any sense wrong so right now we have these scripts that helps us to connect to a database what I'm going to do is I'm gonna write another PHP scripts to help us fetch data from a database so I'm gonna go back again so we don't need to really correct anything here but I've already uploaded this an editor with a server-side so I'm gonna go into this folder install creates another powerful upload developer Collins get it done that's HP I'm just putting this year just to upload and it doesn't have to be here you can just do everything at the server side I guess choose to keep them here they don't affect your flutter projects in any way and not contribute to the functionality here in any way so like we did before a lot of open and closed PHP tags let inside here we are going to be needing this page this page here in the new phone I'm going to be quitting so I'm going to save over par connection what's PHP okay so right now what I want to do is write an SQL query to fetch this data so I'm gonna make a special record query we call it net quality and set it equal to select all from let the table name very like a statement and say collection then prepare and then I'm gonna prepare my query for education then after that our ever change my statement to statement then execute it non up as a key type disk where we gonna retain some resource in the results I will not read it in JSON format I'm gonna go down here and create an array I really so after this I'm gonna look through all the data doubt be retained and then push it into this array so to do that I'm gonna show value in here will agree the new rock record resource from then I'm gonna smiley detoured out the affection from the statement to this results from down here the body all now push it into an array of elegies array moscow russia so it is every push method takes where you want to put the array understand allah put it into money really suggest to differentiate billing code is my array and then the I really want to put inside no matter this will be I guess in a way I'm gonna say the method array and then from the results here we want to take the ideal resource from by taking the ID from the resource and assign it to this idea we also want to take the head in and body so now that we are done with putting this data in an array we want to read this array in JSON format and then the Queen I'm gonna say Apple yes online code when coding on array then my array are gonna save this and go back to our online server here won't upload our farm it's here upload that will help this year I'm gonna check to see what I have no issues okay so you can see we try to do this and then touch with ten this is for the connected fact which is in this phone number this file a Koosh connect 20 successfully with things that I want in this lists so now this is working we're gonna go into a flapper up and try to read this data from them I'm gonna go in the end of that we've already taken a look at it future Buddha you can take a look at the previous tutorial on future builder to get the idea what you're doing here and I'm going to make it quick with this one you okay so I didn't put this in the right place I'm gonna take this out of here supposed to be here now spin there's no error or something so we have this problem yeah I wanna quit the net able to return the data from a database I'm gonna say get back it this doesn't exist yet so I'm gonna go ahead and create it it's gonna be a sink this method will need a well accorded a you are strange well there you are we're gonna get it from here and then I'm going to say oh wait HTTP but get and then we'll provide the URL then for the headers kitchen get some 40 give some then you can see we have this arrow with a guest on decode that de Patri definitely not important if that's convinced you can see that Jason error is gone and then what we're going to be coat the body of the response now here I'm just gonna return the response respond body and then if I have your own ambition run fine then you can see I have this over here so what I'm going to do is instead of just putting this URL here we're gonna cut it and say you are I dot and put through then puts my arm here and I need to restart this but this one still have this error here and I guess it's because of this then I guess I have to restart it saying this because of the way I'm a community guy I'm bringing this before the results which will definitely cocinero because it's like JSON data and can be decoded so I'm way back here to my connection that speech before and then remove that echo statement from them then save and close okay so day now we have this detail returning I'm going to be unreal painted the console you can see so what I want to do mr. obvious with any disrobing it's all to retain this beta here so for the first one for a heading we're gonna see head and see it's not run by this knob is not shot of data but the current index in all this buda and then I want behave you know to sing for here on the quick okey then you can see now we are successfully taking the data into our up okay so don't wait for this tutorial the subsequent videos are gonna learn how to connect our data up to the local host is going to be just the same thing Delta this neuron is going to be on our local computer never got a continue from the sims will fetch the data here are gonna continue inside different database deletes and a whole bunch of stuff so stay tuned do feel free to access of care to my channel
Info
Channel: Norbert Aberor
Views: 29,078
Rating: undefined out of 5
Keywords: flutter tutorial, flutter app, flutter http get, Flutter PHP MYSQL Server Online, Flutter online, flutter php, flutter mysql, Flutter php mysql, flutter, dart, flutter database, flutter http request, flutter server, flutter serverside, 000webhost, triple zero webhost, sign up for 000webhost, 000webhost login, free hosting, flutter local host, fetch data from web server in flutter, fetch data from web server, flutter backend, flutter sql, flutter sql query, google flutter
Id: 3M-rCd-4lOA
Channel Id: undefined
Length: 21min 52sec (1312 seconds)
Published: Fri May 03 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.