How to Connect to A Database Using PDO PHP | OOP PHP Tutorial | Learn OOP PHP. In this OOP PHP tutorial you will learn how to connect to a database using PDO, which is the prefered method to use in Object Oriented Programming.
Article on PDO vs MySQLi:
➤ SPECIAL THANKS TO THE FOLLOWING PATRONS!
Name: Scooterman
Channel Link:
Description: I’m a guy.
➤ 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:
Nguồn:https://phprealestatescript.com/
Xem Thêm Bài Viết Khác:https://phprealestatescript.com/lap-trinh-php
Thanks. It would be great if you could also set an option to make a one-time donation to support you…
Always a big fan of yours!
Could not find driver
Guys help me, how to fix this
How to connect server from CentOS 7 ???
Hi, can you please explain where is the closing connection part?
Note:
If you wish to use setAttribute, you must set the array attributes passed to the PDO constructor itself. If setting attributes with PDO::setAttribute() after instantiation of the object, the driver will not be using these attributes.
So, it should be like this
$pdo = new PDO($dsn, $this->username, $this->password, array(
PDO::ATTR_ERRMODE, PDO::ERRMODE_EXEPTION
));
You complicated this too much… Its actually very simple. Also, your connection doesnt use prepared statement, witch is fully unsecured way to drive your DataBase…
This course is awesome thank you very much my boy!
Don't you continue the series anymore as there are many concepts in PHP. The way you teach is very good.
thank you so much! i'm your big fan now!
on the page for artical doesnt have same code you used on video its same subject but searched for catch and its not on there i looked for the database file and thats not on ther either, can you upload to github the actual code you used?
Laravel please!!
can you suggest me how can i connect to another database if one if failed to connect…Please help is anyone read this…
hey brother we have our project submission on 2nd feb 2019 but we are facing postgres database connection problem in php using fedora can you please help us
Thank you so much!!! Very helpful
Great tutorial series, very well explained and easy to understand.
Keep up the good work!
thank you
If you showed us how to create a database not manual way but with php before connecting. Currently i'm little stuck with that.
laravel please am also waiting men
i like your content men,
I was telling people on the forum yesterday that you are one of the best Php tutor on YouTube. kudos. please can you do a video on making crud using Php pdo and oop? I can do it with Php procedural and also mysqli oop. thank you in advance
these tutorials are near perfect .. keep up the good work 🙂
Are you learning machine learning or algorithms of Artificial Intelligence? Please Reply Me.
after checking there is still error of empty properties.
———-Fatal error: Uncaught Error: Cannot access empty property—-Just did this, but the error message on the database that never existed didn't appear when I did this, even though the database didn't exist
when i add the charset (.";charset=".$this->charset) in the dsn than it gives a error that says: Unknown character set. When i remove it it works. Why is that? chars are: uft8mb4
do laravel please. you're good in teaching.
thank you so much for your tutorials!!
man your tutorials are so awesome
Is the $password and $username attributes mentatory to pass int PDO (…).Can,t i connect the database without these?
It's my first time to take php oop seriously and I find your series more helpful than my instructor.
You earn a sub!
Hey bro
Your tutorials are awesome,outstanding and mind blowing. Loved it alot.Kindly make complete tutorials on php7 and pdo queries. and also laravel. Thanks alot in advance
Make a tutorial on Blender 😀
Yor are a great turor. Please Make a tutorial on Codeigniter.
Hi there mate, some great tutorials going on. I was wondering if you could cover in this series Dependency injection which is the preferred option over the singleton pattern when it comes to connecting and accessing the database from lets say the user class? Also some helper methods that would make prepared statements else where easier to implement (query, bind, execute..etc.)
Question about pdo oop
So I have a log in system with pdo and oop where after a user logs in, he can see a bunch of info on his profile page in a table. I fetch this info in user.php and set the session variables there and check if session variables are set on profile page and display those session variables data in table there.
Is this a good practice to have a bunch of session variable or should I use pdo to run fetch queries instead and forward an array to profile ?
Hey Daniel. How are you? I know this isn't the video about javascript but it is your latest :D. I was hoping you could make different project videos for javascript so I, we all can learn more about it. Like a simple game using javascript, a curtain webpage, idk. Some interactive projects that use html, css and mostly javascript to help learn by doing. Thank you for all your videos!!!
Do you know Python?
If Yes, then please make tutorials on Python..Many people want to learn python
wow. amazing pdo tutorial 😛
sir you are great teacher i got job just for u .. please make videos about laravel i learnt alot from u s i request u please make video course regarding laravl
Could you please make video about Magic Method in php?
Because I love the way your teach.
Amazing !!!
Just in time! Thank u again! Like before even watch the video! 😀
Been looking for this exact subject on your channel! Thanks
Do you use Blender for modeling? 🙂
Thank you 👌👌👌👌