16: Connect To A Database Using OOP PHP | PDO Tutorial | Object Oriented PHP Tutorial | PHP Tutorial

Поділитися
Вставка
  • Опубліковано 24 лис 2024

КОМЕНТАРІ • 105

  • @virtualworkers266
    @virtualworkers266 5 років тому +1

    Daniel was one of my first teachers in PHP, and learning some of the basic techniques was pretty easy to understand because of how he deliver the technicalities of some SPL.

  • @kazimrahman7499
    @kazimrahman7499 5 років тому

    East & West.....Danish Brain is the BEST in programming....Cause....They understand the problems CLEARLY....They go through the steps DEEPLY.....They explain the complex staffs EASILY.....and mmtuts is just Life Saving Awesome....More time I spend with you....More get addicted to know from you....Thanks....& All The Best...Thumbs Up..!!

  • @ProgrammingwithPeter
    @ProgrammingwithPeter 5 років тому +4

    This is so requested by php beginners! Great job!

  • @jjuless7143
    @jjuless7143 5 років тому +6

    Thank you so much! Can't wait for the next OOP PHP tutorial on how to insert and gather information from the database. Keep up the good work!

  • @movyl2340
    @movyl2340 5 років тому +14

    You're missing out to wrap this up in a try catch. Also, it should be recommended to keep credentials inside a config file - even if you don't work with git/bigger teams, just for habbit reasons.

  • @soyaiburrahman3806
    @soyaiburrahman3806 5 років тому +1

    The only OOP tutorials I understand

  • @hey-simba
    @hey-simba 3 роки тому

    love the way that you remind some basic things time by time. like $this-> for property . Even though its basic but really effective for the beginners who might have forgot that and i am one of them.

  • @jsr7599
    @jsr7599 4 роки тому +1

    you're creating a good ripple effect on the world, good for us

  • @WhiteHatRoad
    @WhiteHatRoad 5 років тому +5

    Hi, I just want to thank you for the amazing tutorials of PHP, I learned so much from them, can you please make a video about the testing methods of a web application built with PHP, A lot of people complete the projects and don't have an idea how to test the web application properly and I'm one of them, thanks

  • @abolfazl3273
    @abolfazl3273 9 місяців тому

    This course is awesome!! Thank you :)

  • @welt101
    @welt101 5 років тому +6

    A Laravel series would be awesome!

  • @DereckNoom
    @DereckNoom 5 років тому +2

    Looking forward to the next episode! Thank you for your time and effort! Much appreciated!!

  • @volume864
    @volume864 5 років тому +1

    Thanks a lot for teaching me almost everything about OOP PHP. You're the best one.

  • @purnarai76
    @purnarai76 Рік тому

    Really important php tutorials!

  • @stormybear4986
    @stormybear4986 4 роки тому +1

    I really enjoy your tutorials. You present useful information in a clear, easy to understand manner. i'm a proyd supporter of mmtuts.

  • @sahinyasar9119
    @sahinyasar9119 5 років тому

    Youre way better than my teacher

  • @aguswidi9316
    @aguswidi9316 10 місяців тому

    Mr. Daniel, I have learned a lot from you especially oop php. Could you make another video teaching oop php with mvc, database, and using transaction, commit, rollback feature. Thank's

  • @_uchejnr
    @_uchejnr 2 роки тому

    Thanks pretty straight forward lecture!

  • @hayatzee8830
    @hayatzee8830 2 роки тому

    I'm glad I found you

  • @hansratzingerselbstandiger9786
    @hansratzingerselbstandiger9786 3 роки тому

    Thanks! Great tutorial! Wonderful explained!
    Also imortant to make things easier with character modes, add to the Dbh class:
    private $charset = 'utf8mb4';
    and add it to $dsn:
    $dsn = 'mysql:host=' . $this->db_host . ';dbname=' . $this->db_name . ';charset=' . $this->charset;

  • @aleksandartrisic8443
    @aleksandartrisic8443 4 роки тому +2

    Great work so far, thx a lot :) btw think you should have shown how to close the connection.

  • @hadimokhtari7839
    @hadimokhtari7839 Рік тому

    You are AWESOME , Thanks Alot

  • @ReachOutWorld
    @ReachOutWorld 5 років тому +10

    @mmtuts We are currently missing import / update / select oop pdo tutorials, along with login system with oop pdo
    Please when you have time create them.

  • @yungifez
    @yungifez 4 роки тому +23

    I remember those good old days when connecting to a database was just 5 lines of code

    • @dobidop5356
      @dobidop5356 4 роки тому

      these all are bad guys' fault

    • @michielsimons1828
      @michielsimons1828 3 роки тому

      org 0x100
      mov dx, say
      mov ah, 9
      int 0x21
      mov ah, 0x4c
      int 0x21
      say db "Everything was just better in the old days, was it not?", 0x0d, 0x0a, '$'

    • @yungifez
      @yungifez 3 роки тому

      @@michielsimons1828 I meant in procedural sql

  • @noderole7352
    @noderole7352 4 роки тому

    Dude, your great - seriously classes used to scare the **** of me. Well done man. You rock.

  • @blazehunter09
    @blazehunter09 5 років тому

    I am waiting for the next course so much

  • @mdsultanurashikin6706
    @mdsultanurashikin6706 4 роки тому

    Thanks a lot. Take love bro.

  • @lpanebr
    @lpanebr Рік тому

    Really interesting. But in this one I missed a real world example use case for abstract classes. Thanks!

  • @forcowicz5830
    @forcowicz5830 4 роки тому

    Great tutorial, thanks!

  • @sebastiansernavasco8610
    @sebastiansernavasco8610 5 років тому

    Thank you for making this educative content, it really helps a lot of people. Keep it up.

  • @naty685
    @naty685 4 роки тому +1

    i think i love you, thanks!

  • @codobyte
    @codobyte 5 років тому +1

    Are you planning to create a tutorial building a MVC-based example?
    Thanks for this very nice tutorials!!

  • @Star-zf8su
    @Star-zf8su 5 років тому

    Really!! Really Thanks Very much for making tutorial on this topic I hope you will make full tutorial on this topic and finish it soon....so that you'll make on others😊✌️😀 Topics!!!!.......

  • @newsomething8682
    @newsomething8682 5 років тому +1

    Thank you Master mmtuts, Luv from CN!

  • @ghufranataie1
    @ghufranataie1 5 років тому

    Amazing video thank you so much

  • @anniej432
    @anniej432 5 років тому

    Awesome lessons man! Thank you!

  • @wesleyfeller2114
    @wesleyfeller2114 5 років тому

    welcome back :))

  • @josuebalza369
    @josuebalza369 2 роки тому

    excelent

  • @sharmaprachi87
    @sharmaprachi87 2 роки тому

    thanks

  • @Happystoreup
    @Happystoreup 5 років тому

    Thank you so much!

  • @WideEyesChannel
    @WideEyesChannel 5 років тому

    Hey Daniel you should get python tutorial up and running on this channel. Because your videos content are very very good ❤️

  • @Booleys
    @Booleys 5 років тому

    Good tutorial(s) ! Can you explain why you dont use a constructor to the method?

  • @natiqmumtaz5309
    @natiqmumtaz5309 5 років тому +4

    Hello mmtuts,
    Can you make a video about PHP Authentication.
    Thanks for your good content.
    Best,
    Natiq

    • @Stoney_Eagle
      @Stoney_Eagle 5 років тому

      ua-cam.com/video/xJHkCTviJW4/v-deo.html

    • @Stoney_Eagle
      @Stoney_Eagle 5 років тому

      ua-cam.com/video/LC9GaXkdxF8/v-deo.html

    • @natiqmumtaz5309
      @natiqmumtaz5309 5 років тому

      @@Stoney_Eaglehi,
      I mean OAuth.

  • @meesie1
    @meesie1 5 років тому

    It may be a best practice to use a singleton for the Dbh class, to increase performance.

    • @Dani_Krossing
      @Dani_Krossing  5 років тому +2

      You are absolutely right that a singleton would be a good alternative for the Dbh class. Not just from a performance point of view, but also because we will never use more than one instance of the Dbh class. But again as you put it, it is more of a “best practice” and I felt that I needed to get started on some database examples because a lot people were requesting it :) I will make an episode a bit later on singleton

    • @messismo10
      @messismo10 4 роки тому

      @@Dani_Krossing Please make a video explaining when a singleton should be.

  • @channeltest5201
    @channeltest5201 3 роки тому

    Good day this is a great tutorial, I follow and currently using this method how to connect database, just wondering how to close the database connection?

  • @pragneshkatkar31
    @pragneshkatkar31 5 років тому

    Hello Daniel, can you make video about creating wordpress theme?

  • @danielzapata9099
    @danielzapata9099 2 роки тому

    Gracias crack

  • @KhaledQweder
    @KhaledQweder 5 років тому

    Excelent

  • @ManuelReimann
    @ManuelReimann Рік тому

    Hi Dani, Thank you very much for all the great tutorial, I couldnt finish my projects without you.
    I could recreate everything in the procedural series.
    However with these tutorials i seem to have multiple problems. Is this way maybe deprecated now? Because If i dont hand over the private variables into the connect function, it says it expects variable names. I can't get the connection to work and i have 1:1 the same code as you. Thank you so much or anyone who can answer that dilemma

  • @TaiPham-sf9ht
    @TaiPham-sf9ht 4 роки тому +1

    amazing

  • @JIGA1up1
    @JIGA1up1 5 років тому

    will you continue with this course? Im really interested

  • @facemeukom3900
    @facemeukom3900 4 роки тому

    why you didn't use the $this->dns and $this->pdo inside the method, are they different inside method and outside method. I mean when we define inside class i.e outside method they are properties and inside method they are know as variable or what?

  • @SixtyNeptune
    @SixtyNeptune 3 роки тому

    does making a seperate Dbh class then extend from it to another classes, makes new database connections eveytime i create an instance of that specific class?

  • @subratmca
    @subratmca 3 роки тому

    How to write conditional queries in PDO using OOPs for a senario like:
    Check for a user (i.e. email & phone) during registration before inserting in DB?
    Please advice? One last thing, video tutorials are not organised i guess. Please look into that point also if possible.

  • @adonishomefitness
    @adonishomefitness 5 років тому +1

    Can we get a video on adsense in our websites

  • @AdelinBonheur
    @AdelinBonheur 5 років тому

    Hey could you make for us a video for pagination using PHP & JS

  • @tictac1020
    @tictac1020 4 роки тому

    I don't remember him ever mentioning and I've never encountered it before: what does DBH stand for?

  • @kasunchathuranga7346
    @kasunchathuranga7346 2 роки тому

    hey can you tell me how to get the last id enter to the database in this way, i tried lastInsertId, insert_id both but i didn'd get the id so if you can tell me a way it will be very helpfull for me and thank you for your videos, these are very usefull..

  • @OPGAMER.
    @OPGAMER. 5 років тому +1

    Why most of the user doesn't set the password on their localhost ?

  • @almojaiderbakal3529
    @almojaiderbakal3529 3 роки тому

    what is
    mysqli version of this?

  • @tuditive5607
    @tuditive5607 4 роки тому +2

    Fatal error: Uncaught Error: Call to protected method connection::connector() from context '' in C:\xampp\htdocs\sos.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\sos.php on line 5

  • @DJ0ScHiMMeL
    @DJ0ScHiMMeL 3 роки тому

    I have a question: suppose I PHP-social media page. Do I create multiple Database users that can access the database itself or create one user that can read all of the information from the database? not registered users have access to public posts on this social media page. At the same time, registered users can also see private posts. I thought it might be better to have a general user for the database and multiple others for each account, but I just realized maybe that's all not necessary. Is one enough that displays for every user? How do big companies manage their users? Do they create multiple DB-users for every registered user?
    Thanks :)

  • @jakubfrei3757
    @jakubfrei3757 Рік тому

    Or you could just make it as a static class and then call it in another class to private propeties ?

  • @werkatfischer3183
    @werkatfischer3183 Рік тому

    i understand that users cannot call private methods/properties, but can they see the code for private methods/properties with e.g. inspect element? I don't want to hard code a site's root password anywhere unless I can know that there isn't any way for users to see it, and it's still not clear enough to me what it means for a php file to "include" another php file such that I'm not assured that the information stays safe.

  • @jannickbreunis
    @jannickbreunis 2 роки тому

    Interesting.. "Don't leave a php closing tag." Is that really the best practise?

    • @Dani_Krossing
      @Dani_Krossing  2 роки тому +1

      Yes it is. :) Here are some examples why: stackoverflow.com/questions/4410704/why-would-one-omit-the-close-tag

  • @shums_2.0
    @shums_2.0 3 роки тому

    why not we are using protected variables and private methods here ??????

  • @brigetokai3756
    @brigetokai3756 5 років тому

    Do you have coures on udemy ? Please do node.js tutorail

  • @HazrulAiman
    @HazrulAiman 2 роки тому

    Your face looks like Elon Musk. Its my first time here :>

  • @miroslavsavel7560
    @miroslavsavel7560 3 роки тому

    Hello, is it good practise to log in to the Database as root?? Is it safe to login as root when creating new record in User table? or how do you manage login and registrations. Is it possible to create new user for every new registered user also in Mysql server? How do you handle this in real website? I thought about something like creating a new user (New account on Mysql server) with low permissions when user filled form.

  • @mavvdeus
    @mavvdeus 5 років тому

    Why don't you set the return type of your function connect to PDO?

  • @gustavopacheco919
    @gustavopacheco919 5 років тому +1

    Is PHP still widely used? I keep hearing PHP and MySql are declining in popularity.

    • @ademineshat
      @ademineshat 5 років тому +2

      80% of the web is using php. It's a big Language and it's not going anywhere

    • @ademineshat
      @ademineshat 5 років тому +1

      @Lion what do you suggest, because I'm still using and learning php?

    • @gustavopacheco919
      @gustavopacheco919 5 років тому

      ​@@ademineshat I use PHP on my sites as well, it's a great language. It ticks me off when people tell me it's outdated.

    • @gustavopacheco919
      @gustavopacheco919 5 років тому

      @Lion I use PHP on my sites as well, it's a great language. It ticks me off when people tell me it's outdated.

    • @gustavopacheco919
      @gustavopacheco919 5 років тому

      @@ademineshat I use PHP on my sites as well, it's a great language. It ticks me off when people tell me it's outdated.

  • @catalinim4227
    @catalinim4227 4 роки тому

    that naming convention results in errors.. why not change it to _class

  • @jph5225
    @jph5225 10 місяців тому

    the hat XD :D

    • @Dani_Krossing
      @Dani_Krossing  10 місяців тому +1

      Don’t insult the awesome hat! D:

  • @Ginfio
    @Ginfio 5 років тому

    You kind of look like Mr.Beast

    • @Drirton
      @Drirton 5 років тому +1

      He looks and even sounds a lot like Elon Musk too.

  • @Bittofr
    @Bittofr 5 років тому

    Hey

  • @vladimiratanov1926
    @vladimiratanov1926 5 років тому

    Where are __construct() and __destruct()?

  • @iamtafara
    @iamtafara 5 років тому

    yu look like a mafia boss these days ..

  • @rembrandt702
    @rembrandt702 3 роки тому

    Stick to PDO.

  • @livedielievideos8515
    @livedielievideos8515 5 років тому

    ,,😠😠😠😠😠 you take whole week

  • @livedielievideos8515
    @livedielievideos8515 5 років тому

    😠😠😠😡😡😡You should upload video in 2 days. You are taking too much time. We can wait whole week or more for next video.

  • @adonishomefitness
    @adonishomefitness 5 років тому +1

    Can we get a video using adsense in our websites html and css and javascript