Linux serverlinux web serverNETWORK ADMINISTRATIONS

20 | Connect to a Database From a Website Using PHP | 2023 | Learn PHP Full Course for Beginners

In this PHP tutorial I will teach you how to connect to a database using PDO, from a website using PHP! 🙂 Connecting to a database is necessary in order to query a database, so learning how to connect to it, is the first step to selecting and inserting data, directly from a website.

➤ 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 and YouTube Memberships to share improved and updated lesson material, and for a small fee you can access all the material either from my memberships or Patreon, depending on your preference. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful 🙂

Memberships: https://www.youtube.com/channel/UCzyuZJ8zZ-Lhfnz41DG5qLw/join
Patreon: https://www.patreon.com/mmtuts

source

by Dani Krossing

linux web server

42 thoughts on “20 | Connect to a Database From a Website Using PHP | 2023 | Learn PHP Full Course for Beginners

  • dude is Elon Musk your brother? I saw in one video admit it that he is your relative

  • I am want to be your student for get web developer in HTML and PHP and mysql , how much do need to spend per month ? i have bachelor dree of computer science, But i don't have a good skill in IT

  • Love all the videos, however finding that for this one I'm getting this error "connection failed:sqlstate[hy000] [2002] no such file or directory". Works fine when running the php locally but not on replit.

  • Some question has been on my mind since a while as I am creating some system to record orders during a weekend of the sportsclub (not sure how you call it in English but with the sportsclub we have a 2-day event where we serve food). Anyway, I connect to the database as you do here. And also for the login form for the users (the people taking the orders) I do more or less the same as you do later in this course.
    Now I wonder, do you ever connect to the database with the specific user? Now we always connect with the root user and in fact we only check if the user logging in exists and uses the right password. But we never really connect to the database with that specific user, do we? Or do I misunderstand something?
    Thanks for giving this you view if and when you have some time.

  • thanks, i spent lots of time to find the answer and it is here “Mac need to put root for the password” thanks again

  • WARNING to everyone!!…..he fails to mention anything about having to DOWNLOAD and install PDO…it was such a headache not knowing why my scripts weren't working as I copied exactly what he was doing but read up that PDO needs to be installed and actually "activated" within your php.ini file whenever you download php

    this is super confusing stuff as a beginner…..and not sure if he mentions any of this in other videos, but figured this comment would save others from a headache.

  • I'm trying to make a salon reservation webpage, do I need an Index.html or should I only use php?

  • I mean most times when there was an error it was just me, Not a single thing missed!

  • I have question please answer me , if I use PDO extension Instead of mysqli , and use (mySQL) in mysqlworkbenck will it work?

  • Hello Dani – I am getting "Access Denied for user 'root'@localhost (using password:NO)" error. Not sure what am I missing. Can you please help me?

  • bro ngl you look like elone musk , good video ❤

  • Man/bro thank you so mutch, I am working at this moment at PHP project on my University in Poland and I didn't know why my app doesn't work,ed as app, know is working thank you so mucth 🙂

  • Man, first of all.. thank you for tutorials like this! But.. are you somehow related to Elon Musk?😂😂

  • hi, i have face problem to show the input data in database can you help me to solve?

  • I really like the flow of your videos, it's slow and methodical with plenty of explanation.

  • I am so grateful🤩 for this tutorial… it has really helped me understand what i was reading from a book concerning PDO method…. and also as a good student😇😇 of yours, I did notice that you forgot to add the semi-colon at the end of the PDO::ERRMODE_EXCEPTION); 😇

  • I was like "Elon went back to coding?" You lowkey look like Elon Musk in some angles.
    Anyways. Thank you for this tutorial, youre a legend!

  • wonderful.
    please sir, how can I merge two or more database together, so they can fetch info from one database. example email, account, password etc.

  • thank you so much for doing this, you are so good at explaining things and honestly you are giving out so many practical scenarios that happens ALL THE TIME!! I learn so much from your videos and I will watch a lot of times to fully understand all. thank you Dani!!

Comments are closed.