Это видео недоступно.
Сожалеем об этом.
36: How to connect to a database in PHP | PHP tutorial | Learn PHP programming
HTML-код
- Опубликовано: 12 июл 2017
- How to connect to a database - PHP tutorial. Today we are going to learn how to connect to a database from a website using PHP. In these lessons we will learn how to access a database, and how to get data from a database.
➤ GET ACCESS TO MY LESSON MATERIAL HERE!
First of all, thank you for all the support you have given me!
I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!
I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.
I hope you will find it helpful :)
Material for this lesson: / lesson-material-42361704
tks for sharing this lesson, i was stuck with how to connect my db for my school job, love you
Finally, a PHP tutorial video I can watch without cringing.
Why would you cringe? just curious.
@@Scuffy because he's racist
@@cancerousryan7272 makes sense
I can watch this barely without crying.
thanks man u are a legend. Young programer here from Kenya .
I have a newer 2023 course on my channel 😊
I've already downloaded the whole playlist
I've come back to thank you
great job
guys even if u know the topic ,still watch the vedio to the end u will get new ideas to build Ur webpage.
can you explain why in included php files tag php was not closed
@@umrbekmatrasulov4141 to make the php file pure.
@@hahehi682 pure?
@@hahehi682 can you explain with more detail?
@@umrbekmatrasulov4141 The ?> close tag is not really necessary when PHP code is the only content of the document.
Nice video. Quick and to the point. I wrote my 1st PHP programs almost 20 years, the end of 2000...before RUclips existed. But haven't done much with PHP since. My web server is set to use version 5.3, which is unsupported, so my old programs will run. My old PHP programs need updating to run version 7. Surprise, surprise...things have changed. The old connection method no longer works. This and the next video, helped. Thanks!
I like the way you demonstrate and explain. Creating an interface for a database has been difficult for me. For some reason, there’s always something I’m missing. My code looks right, but it doesn’t work. I am looking forward to going through your other videos on this topic. Thanks!
I can now understand while looking on the screen.
I've learned from you in one day what I couldn't get from college teacher in 4 months
That was so much easier than I was expecting
Really awesome. I am a beginner I really learned a lot . Highly recommended.
Finally, someone who speaks English...phew!
Yes! Those other guys may be good, but there are so many people I can’t understand. My ear is not tuned to their accent.
Exactly. The others may be teaching good stuff but I can't understand that kind of English.
Great tutorial, well explained. How would you secure the DB handler pages from someone seeing the source. Is it based on permissions to the file on the server or by preventing access to this page on the web server configuration? Or some other way. Thanks.
Applause to you sir. Thanks for sharing & teaching your programming ideas, I have learned well through your tutorials 🥰
My goodness... I should have watched your tutorials on the subject years ago - thank you!
I can relate to that
sir i have'nt seen tutor like you , you r the great sir
Lol, after the previous episode, your voice changed from energetic to a more grown man from this new episode XP
ReneMar Remorosa they grow up so fast
Your information is so on point and easy to understand.
Great videos!!! Great explanations, easy to understand and very well taught
Thank you
can you explain why in included php files tag php was not closed
@@umrbekmatrasulov4141 Cuz it was a pure php file
Such a clear explanation man...!! Loved it very much. Thank you for making such a informative video.
Put that include in a directory above root (above www), not below, and make the variables constants.
Thank you for the video!
this what i need, thank you
THANK YOU VERY USEFUL< AFTER ALL THOSE YEARS< AND TIME EVERYTHING IS JUST A MATTER OF TIME.
Nice tutorials ... helped a lot ...crisp and clear... keep going👍👍
must thank you for your video
you just know how to teach..thanks a lot
Great video!!! It really helped me out A LOT! Thanks!
Why not using "require" instead of "include"? If something goes wrong, "include" can expose your data, because it will continue to render page displaying content, while "require" will stop page rendering.
I think that's why it's include_once rather than include
include_once and include anyway will countinue to render page displaying all code to the end. In login system you dont want this kind of stuff so you should use "require" or "require_once".
MBZ Master
bro you don't get it do you? this is just a sample and I know you know that but the reason why he only uses include cuz his not making a website or anything important that's why he used root right? this is only a sample for people who are studying for IT to make things easier and I know that they will learn that there are other function besides include like require in the near future so just relaxed cuz there will be more episodes to see
@@harridomana5862 Teaching the wrong way first is a great way to learn bad habits lmao.
Love your tutorials! I learnt html thanks to you!
Great explanation. Thank you!
Thank you!
Gracias!
Obrigado! 🙏🏽🔥
Hello, could you try to make a video on user profile pages. What I mean by this is: when a user registers for the first time, it makes a new page for the user and displays information about them (avatar, username etc). If the page is about them, then they can edit information in some sort of settings section or something along those lines.
Would mean a lot, as I cannot find anything else on the internet or youtube.
Thanks, Will.
beast♥♥♥ im watching u from lebanon keep it up
Hi, how do i know my server name because I'm installing mysql in my linux server. What to replace with the 'localhost'?
localhost refers to your computer, this is default, but i don't really know so...
Great video ❤️
Great video, don't get me wrong. My frustration is the following: every tutorial, and I mean every one, always uses "localhost" as the database. Now, how do I connect to a remote database using php? It's just frustrating that every tutorial chooses not to handle this.
You log into your hosting sites dashboard and get that information. If you can’t find the dashboard or the database info, ask them where it is 🙂The reason you don’t see tutorials showing you this is because every hosting site is different.
I have a question is that how did I do to link other server?just need input ip? Thank your response.
আয়ায়ায়া +র
What did you use to write down this code ? where are u writing it ? i wanna connect using PHP PDO to PostgreSQL Database but i don't know where to start
awesome video , nice explanation
Thank you so much! amazing tutorial!
thank you so much . It's really good tutorials
Very nice! Thank you !
MERCI BEAUCOUP
Which one do companies use more at work, MYSQLI or PDO?
This is great.. So, if you have it written in the incorrect order, it won't connect?
It worked!
Make video on connect dB with Singleton pattern
Hello dear. Atlast i find a very good php tutorial! Now can you please suggest a tutorial on - 1) how to design the database on complex projects.
I am yet to find one like this.
Thank you :D Great video.
very helpful video
question, how do i pass this $conn to a function so that i can use it to run an sql statement within that function?
I was using your previous method:-
Hi. I just want to ask, when I am establishing a connection between database and php. It gives me error because it doesn't read the $conn. Why is that so? Please help me.
you r perfect thank you
Is it neccesary to declare variables for the 4 parameters? I see other videos just straight putting localhost, root, pw, dbname in the parameters..
Or is it just a good practice? Is there a difference?
Helpful
do we really need to create the four variables on the top? I found some examples where they has not been created so I just want to have clarity on this.
Well - I think this is a good practice + makes it easier to understand to others, but it's never wrong asking:)
where would you put your includes folder in the Wordpress Stack?
Thank You very much
Thanks
sir,can you please make a video on creating a user profile in php?
Hi sir! I'm a beginner in webdev. How many tables in database do I have to create for a website? Will it affect how the website response/loading?
Amazing tutorials! It is almost TOO EASY! Ι have a question thought what theme are you using for your code?
It's sublime text editor
How do you initialize multiple connections to multiple databases? I have form fields that come from other physical databases.
Thanks .can you do a video on how to make your files downloadable using php
great tutorial
What even is the type of program you're using to code the connection?
Hello sir
Why i cant include my folder
It name was addtion then the php file name is db and the code doesnt read it?
Please make a database video with PDO :)
Hi mmtuts, I really liked you videos, also your voice soo cute.. lol...
it really helps me alot to learn php in easy way.
I am having a simple request..
PDO login & register form (CRUD) along with facebook login (SDK)
Pl its a request. Reply back
what changes will i have to make in this code if it was for sqlite instead of mysql
Hey, I'm still learning, but this is actually not to connect but to link a database to a site, right?.
I mean, this is like the first step, declaring the database, it's not like when you log in or sign up, right?.
Hello mmtuts can you please help me validate my PHP contact form before saving to database ?
I have already installed xampp and created a database. Now i have created a separate php form for connecting my HTML form to the database but when I try to execute it the php script is displayed by the browser instead......how can I connect my login form to the database please?
great tutorial as usual! i have a question, why did you write include_once and not the regular include? what is the difference?
include_once makes sure that if we accidentically include the same file twice on the same page, then we get an error. This is to avoid having duplicate code.
mmtuts oooh I see, thank you very much for taking the time to reply to me. You are awesome! :)
great videos, can you show us how to host a php website on hostgator that uses a database
So nice video
In this example you used include_once @7:29 and not just include. Is it necessary? I thought you would use include_once for example in a loop, where you need something to be included once, while the loop continues to do stuff.
Suppose if we have included a file two times in our code the it will show an error and we don't want that. So by using include_once it will not show any error even when we included a file more than one time.
For whatever reason my index.php file does not recognize my dbh.inc.php file. my index.php and my includes folder are in the same directory but its not registering it. Any suggestions?
Thank you mmtuts for the tutorial. When I tried to connect to the database I am getting the message: Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] I have spent several hours trying to figure the problem. Any ideas? thanks again.
Note: For MAC OS
Open MySQL from System Preferences > Initialize Database >
Type your new password.
Choose 'Use legacy password'
Start the Server again.
Now connect the MySQL Workbench
What about Window System
Please I need some help… I could not understand how this thing make the information about the user when he/she “sign in “ will being appear in my admin.. I search for it in google but all I found doesn’t expelan enough.
What does $conn variable return? Boolean (connected/connected) ?
So far you have said how to connect to an outside server but you didn't give an example.
I understand for localhost,, but what about my service provider servers?
$dbServerName = "db12.server";
// would this be correct to write it like this connect to my host provider db server?
$dbUserName = "usrName";
Etc, etc.
Is that how I would write it? Or do I have to put a http?
Thanks for your time.
It differs depending on the hosting provider, but you usually have a link in your dashboard once you are logged into the hosting services website, that gives you the information of your server.
Vell don vasu vell don ✌🏻
Hi.
In this video you show connection between PHP and mysql using XAMPP, but i want to connect my php with Mysql database without using any local server (Xampp, Apache, etc).
can you give me solution?
Parse error: syntax error, unexpected '$host' (T_VARIABLE) in C:\xampp\htdocs\NewTestRegistration\connectDB.php on line 4
massive bro
can you teach about how to make your own version of amfphp
Some videos, like this one, have choppy playback of sound on my chromecast 1st gen. Very frustrating. I bet it's about the video format.
Haha good one 😉
This code syntax doesn't work in IDE Atom it's almost like you have to hard code the connection script for IDE Atom to know what variable your calling. sgls in this scenario don't work either :( what's another ide i can go with for my next assignment.
Your text editor has nothing to do with your code not working. It’s just a tool. 🙂 I can guarantee you that the error is happening because you set your website up incorrectly, or you made a typo.
Hi, came accross this video after searching way how to secure password of username used in connecting to database. Our IT windows server admin has access to our server and has access to read our php folder. They able to read the user and password defined in configuration. By any chance, cost free :) do you have idea how to mask or hash the password? Hope you will answer this pls.
sir i have followed exact your steps but my dbh.inc.php does not looks like yours. where am i going wrong. that text ($dbServer=....) is still in white color. please help me.
It's great.
where do i find the servername of my website? from the c-panel?
search in the file config.find out the wp-config.php after that view the data you will find out the servername
bt bydefault server name is '
localhost'
Great
What books did you read in order to figure all of this out?
I have mysql software installed instead of xamp how can i connect to it
i always have a parse error on line 8 . after 3 h of trying to fix it i couldnt do it :(
Sorry, but i followed the same steps but it didn't show in my localhost as a loginsysytem, i don't know where i am lacking, can you please tell what could be wrong?
How do I set the php note for it codes inside windows 10