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

Поділитися
Вставка
  • Опубліковано 9 лис 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.

  • @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.

  • @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!

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

    This is so requested by php beginners! Great job!

  • @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..!!

  • @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.

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

    A Laravel series would be awesome!

  • @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

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

    Really important php tutorials!

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

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

  • @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.

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

    This course is awesome!! Thank you :)

  • @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.

  • @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.

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

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

  • @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;

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

    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

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

    You are AWESOME , Thanks Alot

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

    I'm glad I found you

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

    Thanks pretty straight forward lecture!

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

    Youre way better than my teacher

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

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

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

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

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

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

  • @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!!!!.......

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

    I am waiting for the next course so much

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

    Thanks a lot. Take love bro.

  • @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

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

    Great tutorial, thanks!

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

    Awesome lessons man! Thank you!

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

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

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

    Thank you Master mmtuts, Luv from CN!

  • @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

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

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

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

    excelent

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

    Amazing video thank you so much

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

    thanks

  • @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?

  • @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.

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

    i think i love you, thanks!

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

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

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

    will you continue with this course? Im really interested

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

    Gracias crack

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

    welcome back :))

  • @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.

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

    Thank you so much!

  • @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?

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

    Excelent

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

    Can we get a video on adsense in our websites

  • @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.

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

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

  • @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

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

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

  • @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..

  • @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 :)

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

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

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

    what is
    mysqli version of this?

  • @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.

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

    amazing

  • @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.

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

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

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

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

  • @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.

  • @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

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

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

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

    the hat XD :D

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

      Don’t insult the awesome hat! D:

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

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

  • @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.

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

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

  • @bittosmooth3555
    @bittosmooth3555 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