PHP MySQL in DreamHost Tutorial 5 – Coding our MySQLi script
Tutorial Hosting
Welcome back to Caleb the video maker – this is the series of installing MySQL and PHP on DreamHost so where are we exactly we are in FTP through FileZilla and were connected to our website as you can see I’m actually using the domain name PHP MySQL tutorial dot Dream hosters com
And you can see I’m connected to the website and we’re actually going to create a PHP script that is going to connect to our database so we already have index dot PHP but there’s nothing really in it so let’s go ahead and edit it I actually already have it open so
I’m just gonna slide over here this is it that’s all we got well we’re actually going to clear this out and I’m gonna teach you a little bit about PHP but do keep in mind that this is not a PHP tutorial series by any means the very
First thing you’re going to want to do is run a function and that function is called MySQL of MySQL I underscore connect and then open parenthesis this thing is going to have four arguments the first one is the host the second one is the user this third one is the
Password and then the fourth one is the name of the database so where do we get that information well that is the same information that we used when we created our database so I actually took a snapshot of it let me scroll over here here is all of my information although
If you need to find yours you can go into the panel go to goodies MySQL databases then you can find most of your information here you can find your database name the user and the host name and then I put the password in here as the description so that way I didn’t
Have to remember it so all we got to do is put those in exactly perfect don’t mess anything up I’m just going to place where they go so that way I don’t forget any and then I’m gonna go back and fill them in the first one I’m always going
To do is the host because that’s the one that determines whether we can connect at all so comparing to this we just probably can just copy this paste that in there and then the next one is the username which is right here third one is the password which is right here and
Finally the fourth one we need the database name now all we have to do is go back to our website and I’m gonna show you guys the classic mistake so all we got to do is go to domains manage domains and then we can visit our
Website and it says hello well what the crap I updated that file but nothing happened that’s because we have to remember to go through FileZilla first there we go upload it let it finish well done now go back to the website do refresh and you
Can see the page is blank so that could be good or that could be bad if it’s blank because of a good reason that means nothing bad happened and it’s working if it’s blank for a bad reason it means you have errors turned off and it just doesn’t show you anything even
If there is something broken so let’s let’s say that we have an incorrect website and we just put wrong website right here save it upload it and refresh you can see we’re getting errors now let’s compare these errors to the ones with the username and password and I’m
Going to mess up the username here go back refresh oh got uploaded all right access denied for user PHP MySQL tutorial now this is a little more helpful to me because I know that I was actually able to make a connection to the host I just have the wrong username
Password or database so that makes debugging a little bit easier for me so what you can get from this is that if your error looks like this then the first thing you need to do is fix your host not your username your password or your database if you go in here and
You’re like crap my usernames not right you’re wasting your time because you’re not even making a connection to the thing at all so it doesn’t matter whether your username or password is right it’s kind of like imagine trying to sign in to YouTube but you’re actually not on YouTube it would make
More sense to go to YouTube before you try correcting your username and password I think you guys understand what I’m saying so let’s fix that upload it and refresh no errors so that means we are officially connected to the database now if you guys are getting
Some errors you can post them in the comments and if I know the answer I’ll reply or if you guys have a similar error and you’re able to help others you can reply to people who have common issues below and that way we can help each other out but just make sure that
You look over this very carefully that you got every single thing absolutely perfect on here and also I wanted to point out this is not the same user and password that you use for FTP if I go back to FileZilla you can see I have kalcker to with a password and I’m
Connecting to the website it’s not the same in fact though even the host isn’t the same on here there’s no MySQL but here it’s MySQL dot PHP SQL tutorial doctoring posters com so the host and the user and the and then the additional database they’re all different so don’t get them confused
With File Transfer Protocol there are two separate things that’s basically all I have to say in this video now that we have a connection to the database in the next video we’re going to actually display some information on the page from our database so that one’s gonna be
Fun because we’re actually gonna finally do some real coding and making our first app I guess you could say so thanks guys be sure to subscribe and I’ll see you in the next video what are we iterating over we’re iterating over each row and what is it we want to access within the
Row we want to access the column or if you want to name it a little more specifically you could say the field because that is an individual value for a column and then within here we could echo the field let’s save it
Start your career as a software developer – https://calcur.tech/dev-fundamentals 💯 FREE courses (100+ hours) – https://calcur.tech/all-in-ones 🐍 Python course – https://calcur .tech /python-courses ✅ Data Structures and Algorithms – https://calcur.tech/dsa-youtube ~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~ ~ ~~ ✉️ Newsletter – https://calcur.tech/newsletter 📸 Instagram – https://www.instagram.com/CalebCurry 🐦 Twitter – https://twitter.com/calebCurry 🔗 LinkedIn – https://www. linkedin .com/in/calebcurry ▶️ Subscribe – http://calcur.tech/subscribe 👨🏻🎓 Courses – https://www.codebreakthrough.com ~~~~~~~~~~~~~~ SUPPORT ME ~ ~~~~~~~~~~~~~ ↪ My Amazon Store – https://www.amazon.com/shop/calebcurry 🅿 Patreon – http://calcur.tech/patreon-calebcurry 🅖 GitHub Sponsors – https ://github.com/sponsors/CalebCurry Ⓟ Paypal – http://paypal.me/calcur 🅑 Bitcoin – 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq 🅔 Eth – 0x350139af84b60d075a3a0379716040b63f6D3853 📈 Buy Bitcoin – https://calcur.tech/crypto Reserve the Ruby Steel -Crypto Rewards Card and get a $25 bonus (use affiliate code “Caleb”) – https://calcur.tech/crypto
#PHP #MySQL #DreamHost #Tutorial #Coding #MySQLi #script
https://i.ytimg.com/vi/C4UGKinVe6Q/hqdefault.jpg