Much the same as Nitin Gupta below, I followed your entire Procedural PHP course and was very impressed. What would it take to get you to complete this OOP MVC PHP course? I don't have much to give, but if a 1000 people following these videos donated $10... well, that's $10,000. Just saying.
I really like your PHP tutorials. I've watched several of your videos. The only complaint I have is that you use mysqli and not PDO method for database connections. I use PDO because of its versatility and wish you could use it as well to help me and others follow your tutorials more easily. Thanks anyway for the help you've been to me! Great job...
hey i am waiting for you to add more videos about oops php. i followed your whole series about php. now i want to learn oops php. if not your videos then please suggest me a good channel or book or some links?
I have to say, your videos helped me tremendously. Please do a video on how you can fetch stored data according to user ID using OOP. greatly appreciate it
Best lessons on the web! You got a gift to explain complex things easily. I watched and finished your PHP series and it has helped me a lot. Keep it up bro, you rock.
These are great tutorials! Thank you so much for providing these. Regarding timeframe 11:07 ... Not sure, but I think PHP 7.1 may require initializing $data somewhere after line 5 with something like "data = array();" _So function would look like:_ protected function getAllUsers() { *$data = array();* $sql = "SELECT * FROM user"; $result = $this->connect()->query($sql); $numRows = $result->num_rows; if ($numRows > 0) { while($row = $result->fetch_assoc()) { $data[] = $row; } return $data; } } At least that's the only way I could get it to work on Ubuntu 18.04 with PHP 7.2.15. I was getting this error: "PHP Fatal error: Uncaught Error: [] operator not supported for strings in ... includes/user.inc.php:14 ... I hope this helps someone!
Great video! However one thing is not clear to me: why not assign the values to the private variables straight away and not in the "connect" function? Thanks!
Nice video! Are you going to continue with this series? Maybe you can make a long video where we can see the advantage of OOP PHP well. You have given the example of a login system in the last episodes. We know how to make a login system from the normal PHP tutorial series. But maybe you can make a video about it in OOP PHP. And point out the way you need to do it in OOP PHP and the advantage more than the login system itself.
In which folder is the database stored? Is it in the same folder where you store your php files, or do you create a subfolder like when you do to put CSS, JS or images for example, or is it somewhere else?
I’m not sure I understand the question. In the video I show that I save the dbh file inside a ‘includes’ folder. If you mean the database we create inside phpmyadmin, then it gets stored somewhere inside our XAMPP installation, and is not something you need to worry about. 🙂
the server CPU and memory overhead of PDO is much more then MySQLi ... and if you are not worried about migrating to a different database server down the road... MySQLi is much better. This is not what most people say... but it is a fact.
Good. Tutorial..i have a doubt inline number 14:58 .. we have included database connection. Doest it really required. As the third file extends from the dbh would be possible to fetch db connection.?
Good day sir Nice tutorial . . Can i put my connection to database in __construct method or not ?? just wondering so it will be automatically connected :D ??
Sir I am creating a register and login system using php object oriented approach however I've already created it in procedural style. What I am confusing at is is it necessary to use $conn = new mysqli() inside a connect() function ? can't we use it write is outside that connect function by creating constants instead of variables and then extend the Dbh class and use the $conn directly with prepared statement ?
very good tutorial mate. though one thing isn't very clear to me. Why create a new class ViewUser which extends the User class, and why not using the same User class for both methods getAllUsers() and showAllUsers()? thanks!
We are separating the two classes because we want to have one class which handles all database queries, and another class that shows the data on the website. It is perfectly possible to do it the way you are suggesting, but because we are following the OOP MVC design pattern, we are separating the functionalities.
hey mmtuts. I'm confused. Why did you create another class called ViewUser.inc.php if you can put the function that you've create to the class of user? is it because of MVC?
My code didn't work when I included all the files "dbh.inc.php" "user.inc.php" and "viewuser.inc.php" in the same order as shown in the tutorial in my "index" file. However when I included "view" file in my "index" file and "user" file in "viewuser" file and "dbh" file in "user" file my code worked accurately. I also tried different arrangement of files in my "index" file but none of them worked. Solution required "How to include all the files in the Index file so that I can get the desired result." thanks
Was wondering why use the properties in the dbh class if there is nothing set in this example. Can use enter the properties directly when creating the $conn object. But I'm guessing you want to explain it in an OOP fashion where later some values can be put in the connect function.
It's a good habit to keep sensitive info private. If I were to include the database info directly in the $conn, then the info would be protected and not private. Since we only want to make it possible to access this info in the Dbh class.
Hi, Your lessons are really helpful. Thank you for your work! Maybe anybody can clarify a little thing to me. I have done everything the same as in video, but when I try to check result - each element from DB returns 2 times. Where can be a mistake? Thank you in advance.
How do i output only one column? not in the function code but in HTML. Fore example: I want one html field to output name, second to output id. i get all the rows in one field if i use the above method.
@@Dani_Krossing Oh yes, you are right l overlooked that one class extends the other. So I think in javascript the order doesn't matter but in PHP it does. However I'm not sure about javascript too. The simplest way is to try it out. Perhaps you know how Javascript reacts if one do not care about the order of included javascript classes.
Can you check if the database did connected with this code ?? if ($this->conn->connect_error) { die("Connection error" .$this->conn->connect_error); } echo "Connected Succesfully";
I apologize for being such a newbie but I understand that this connection file is kept in a includes folder. Now i have a file called login.php and register.php which need that connection information. I put at the top of these files the include reference to this connection information file. However when i now try to use this connection information in both of these files i get a undefined variable for $conn. What am I missing?
That seems odd since the $conn should be accesible inside the login and register files. Try checking that you spell everything correctly and included the file path in the correct way.
I have problem that with the code in the video tutorial, my results do display but each line is displayed twice. So I have 4 results, while my database only has 2 in it.
Great tutorial series, learnt loads so far. I'm getting an error message at the end of this one. Not sure where I've gone wrong. Gone through it several times. Any thoughts anyone? "Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\OOP_12\includes\viewuser.inc.php on line 7"
Can someone give me some tips on how to insert data using this method? I've been toying around with it for some time, but I haven't had any luck so far
Hello, great tutorial! I have a question: how can I access to single fields? something like this: foreach($datas as $data) { $username = $data["username "]; $password= $data["password"]; } I'd like echo only Username o Password here: $leads->showAllLeads(); thanks!
Please use naming conventions. don't use getAllUsers, use getUsers, that way you can add an optional "limit" parameter so you don't overwhelm your database retriving 9 million users at once, name your users variable "users" because it contains User instances (not really because you didn't use class mapping, but it should), that way you know what the variable contains. If you name it "datas", fuck knows what's in that variable, plus you could have another variable with the same generic ass name later in your code.
That is also a possible way to query :) However it is using PDO and not MySQLi like mentioned in the video title. In a later episode I go over PDO connections as well since PDO and MySQLi both have pros and cons ;)
Man, your lessons are exciting! I'm from Ukraine, but l understand your videos better, than videos in native tongue from other authors!
Геннадий Акулов Thank you :)
I am from Russia and can agree with Gennadi.
I'm from Brazil, and I can agree with you guys :D
Agree with you all and I'm from Moldova)
I'm from Poland. I won't argue with any of you, guys :-)
Much the same as Nitin Gupta below, I followed your entire Procedural PHP course and was very impressed. What would it take to get you to complete this OOP MVC PHP course? I don't have much to give, but if a 1000 people following these videos donated $10... well, that's $10,000. Just saying.
very nice and clean, although lack the controller part but its much easier to understand simplified code like this. Thank you, keep up the good work!
I really like your PHP tutorials. I've watched several of your videos. The only complaint I have is that you use mysqli and not PDO method for database connections. I use PDO because of its versatility and wish you could use it as well to help me and others follow your tutorials more easily. Thanks anyway for the help you've been to me! Great job...
Thanks for this info bro, now I can connect and fetch my data from my database using OOP, because all I know is procedural programming.
hey i am waiting for you to add more videos about oops php. i followed your whole series about php. now i want to learn oops php. if not your videos then please suggest me a good channel or book or some links?
Thanks Dani, you helped me finally connect to my database via PHP and retreive some data. :) Here's a like. It's the least I can do.
I have to say, your videos helped me tremendously. Please do a video on how you can fetch stored data according to user ID using OOP. greatly appreciate it
Thank you for the excellent tutorial.
The first video that I've watched that actually helped me understand oop ;) thank you so much
Such a great teacher! I hope to watch more videos from you! I watched all videos at once!
Thank you very much. Your videos are very, very helpful. Along with your great tutorials, I'm trying to fulfill my dream of becoming a programmer.
Hello, man. I'm from Brazil and I love your videos. You're so good. Congrats, teacher.
Best lessons on the web! You got a gift to explain complex things easily. I watched and finished your PHP series and it has helped me a lot. Keep it up bro, you rock.
Thank you :) I'm glad you found the lessons useful
Really useful now i find programming interesting thanks :)
I am enjoying your tutorial series a lot. You explain so well.
The sound of your voice always makes me very happy. I love your videos!
please make a blog or some news website example using oop and mvc whit routing etc. your way of explanation is very clear. thank you!
Thanks very much! This was exactly what i was looking for. Great tutorial.
Thank you so much for this tutorial. Hoping for the continuation of this series.
This video helped me a lot. Thank you man!..... I'll share you until the end of times!
You are an amazing teacher... love the way you make it so simple to understand
thanks that's so helpful
Very precise and clearly explained. I subbed you.
These are great tutorials! Thank you so much for providing these.
Regarding timeframe 11:07 ... Not sure, but I think PHP 7.1 may require initializing $data somewhere after line 5 with something like "data = array();"
_So function would look like:_
protected function getAllUsers() {
*$data = array();*
$sql = "SELECT * FROM user";
$result = $this->connect()->query($sql);
$numRows = $result->num_rows;
if ($numRows > 0) {
while($row = $result->fetch_assoc()) {
$data[] = $row;
}
return $data;
}
}
At least that's the only way I could get it to work on Ubuntu 18.04 with PHP 7.2.15.
I was getting this error: "PHP Fatal error: Uncaught Error: [] operator not supported for strings in ... includes/user.inc.php:14 ...
I hope this helps someone!
Yeah it help me to fix the errors, thanks!
thanks for your lessons its so easy to follow specially your
html css tutorials
One of the best tutorials i ever seen , thank you very much for this interesting video !
Hello 👋 I'm used to using PDO on database handling, I just wanted to know what is better to use, mysqli or PDO? Thx.
They are both good, obviously if your using my SQL it's better to use the dedicated mysqli handler, but PDO will work just as fine.
nice. why do use classes instead of functions to query the db? i struggle with the seperation logic. thx,
concise and understandable!
your tutorials are amazing, please keep working on them as possible as you can :D
dude you are sent from heaven, for sure. thanks for your amazing work.
Great video! However one thing is not clear to me: why not assign the values to the private variables straight away and not in the "connect" function? Thanks!
Amazing video 💯👍🙏
This has just answered a big question! Thank you very much Daniel :-)
Is it possible to use OOP to make a login system?
Hey man amazing tutorials on php on youtube by far. Keep it up. Can u kindly do a tutorial on an oop login system? That will be awesome.Thanks
it's really helpfull to me. could u make complete tutorial on oophp with mysqli(E-commers level)
thanks for ur knowledge
Very nice explanation....Thanks man
Very Nice work beautiful flow of concepts...amazing It helped me A LLoT :)
Hi, do you have a tutorial for PHP OOP CRUD? thank you. I liked your videos
thanks
Hi, Where the rest of the tutorial ,are you done?. Very useful....thanks man.
You are amazing!
Great tutorial thanks. What packages are you using for php?
Nice video!
Are you going to continue with this series? Maybe you can make a long video where we can see the advantage of OOP PHP well. You have given the example of a login system in the last episodes. We know how to make a login system from the normal PHP tutorial series. But maybe you can make a video about it in OOP PHP. And point out the way you need to do it in OOP PHP and the advantage more than the login system itself.
Hi there, yes I will continue this series once I get the time for it. A login system in OOP is the plan for the next episode :)
please! Thank you so much!
looking forward to this!
I was wondering if you could integrate this into your login-system video :) I would love to see how OOP could be used that way.
I have planned to do so in the future ;)
Is this still on your list? I really look forward to that video!
In which folder is the database stored? Is it in the same folder where you store your php files, or do you create a subfolder like when you do to put CSS, JS or images for example, or is it somewhere else?
I’m not sure I understand the question. In the video I show that I save the dbh file inside a ‘includes’ folder. If you mean the database we create inside phpmyadmin, then it gets stored somewhere inside our XAMPP installation, and is not something you need to worry about. 🙂
so so so so good!!!!
the server CPU and memory overhead of PDO is much more then MySQLi ... and if you are not worried about migrating to a different database server down the road... MySQLi is much better. This is not what most people say... but it is a fact.
could you make videos about how to make a design for files, classes, folders? How should we divide codes into files?
I really like your teaching style! Can you make a register and login system plus email activation for php oop?
Hi, great stuff, I have a question, if I want create a separate file for SQL credential how the variables are collected by db connect class
I thought you did a great job teaching OOP. Can you let me know what editor you use for PHP?
He's using Sublime Text
Nice tutorial. Could you focused more on OOP PHP rather than html/CSS? Also do you take donation?
I have plans on developing further on OOP PHP once I'm settled in properly after moving :) I gratefully accept donations on my website www.mmtuts.net
nice tutorial
Good. Tutorial..i have a doubt inline number 14:58 .. we have included database connection. Doest it really required. As the third file extends from the dbh would be possible to fetch db connection.?
Good day sir Nice tutorial . . Can i put my connection to database in __construct method or not ?? just wondering so it will be automatically connected :D ??
What determines the choice of which type of connection to use between Mysqli and PDO ?
Ah! procedural was much easier to write the connection! Is there any harm in using procedural way to write connection and write all other in OOP?
Sir please create CRUD application with OPP and Ajax concept please
pls make tuts for PDO..
Sir I am creating a register and login system using php object oriented approach however I've already created it in procedural style. What I am confusing at is is it necessary to use $conn = new mysqli() inside a connect() function ? can't we use it write is outside that connect function by creating constants instead of variables and then extend the Dbh class and use the $conn directly with prepared statement ?
Hello sir do u have a video on how to create food product inventory with database?
very good tutorial mate.
though one thing isn't very clear to me. Why create a new class ViewUser which extends the User class, and why not using the same User class for both methods getAllUsers() and showAllUsers()?
thanks!
We are separating the two classes because we want to have one class which handles all database queries, and another class that shows the data on the website. It is perfectly possible to do it the way you are suggesting, but because we are following the OOP MVC design pattern, we are separating the functionalities.
oh right! we're following the MVC pattern, thanks!
Wondering where you get all your content to make these video tutorials? What is your source?
Back from when I was studying my bachelor in web development, and some paid online courses :)
hey mmtuts. I'm confused. Why did you create another class called ViewUser.inc.php if you can put the function that you've create to the class of user? is it because of MVC?
sup man....awesome tutorials. But are you done? Where the rest of the tutorial @ lol.
hey does this vedio belong to any playlist or its just a random vedio?
My code didn't work when I included all the files "dbh.inc.php" "user.inc.php" and "viewuser.inc.php" in the same order as shown in the tutorial in my "index" file. However when I included "view" file in my "index" file and "user" file in "viewuser" file and "dbh" file in "user" file my code worked accurately. I also tried different arrangement of files in my "index" file but none of them worked. Solution required "How to include all the files in the Index file so that I can get the desired result." thanks
Was wondering why use the properties in the dbh class if there is nothing set in this example. Can use enter the properties directly when creating the $conn object. But I'm guessing you want to explain it in an OOP fashion where later some values can be put in the connect function.
It's a good habit to keep sensitive info private. If I were to include the database info directly in the $conn, then the info would be protected and not private. Since we only want to make it possible to access this info in the Dbh class.
Hi,
Your lessons are really helpful. Thank you for your work!
Maybe anybody can clarify a little thing to me. I have done everything the same as in video, but when I try to check result - each element from DB returns 2 times. Where can be a mistake?
Thank you in advance.
Thank you sir.. this helps me a lot as a student.
Could "viewUser" be a method within "User" class instead of object "viewUser" that extends "User" class?
nice
i want a video for how can i insert items in data base in oop php ? plz
Why these older lessons aren't in oop php playlist?
Plz make a video login system in oops
How do i output only one column? not in the function code but in HTML.
Fore example:
I want one html field to output name, second to output id.
i get all the rows in one field if i use the above method.
I'm sorry if this is a stupid question but, can you really run it without error without "?>" in the end of a
Yes as long as there is only PHP :)
In newer versions of PHP, yes
Why don't you use a constructor within the dhb class?
nc tutorial :D
Thank you :)
Waiting for oop mvc mysqli project??
i fucking love you. thank you so much u just saved my ass xD
The order of your include files doesn't matter as long you call its methods and properties afterwards.
Last time I checked the order does matter when you include them in your header, otherwise the class files can't refer to one another.
@@Dani_Krossing Oh yes, you are right l overlooked that one class extends the other.
So I think in javascript the order doesn't matter but in PHP it does. However I'm not sure about javascript too. The simplest way is to try it out. Perhaps you know how Javascript reacts if one do not care about the order of included javascript classes.
playlist link please...!!
How to make logout session for all files
Hey can you please help I am get an error call to a member function fetch() in the while loop
Can you check if the database did connected with this code ??
if ($this->conn->connect_error) {
die("Connection error" .$this->conn->connect_error);
}
echo "Connected Succesfully";
return $this->conn; ???
Can we display mysqli error in inherit class insert?
lf yes how
so the "." keyword stands for "+" because I am confused I always use java.
I apologize for being such a newbie but I understand that this connection file is kept in a includes folder. Now i have a file called login.php and register.php which need that connection information. I put at the top of these files the include reference to this connection information file. However when i now try to use this connection information in both of these files i get a undefined variable for $conn. What am I missing?
That seems odd since the $conn should be accesible inside the login and register files. Try checking that you spell everything correctly and included the file path in the correct way.
I have problem that with the code in the video tutorial, my results do display but each line is displayed twice. So I have 4 results, while my database only has 2 in it.
how do you update records? Is it something liked... $sql = UPDATE from user WHERE id = 1? I like to update my emailactivation to 1...
UPDATE user SET--------- THEN YOU USE THE WHERE statement
Great tutorial series, learnt loads so far. I'm getting an error message at the end of this one. Not sure where I've gone wrong. Gone through it several times. Any thoughts anyone?
"Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\OOP_12\includes\viewuser.inc.php on line 7"
Make sure you have some data in the table. If not, the method getAllUsers won't have any return and so you'll get that error.
@@matheusalencar6708 Where to use a key with ELSE
echo "No record found!";
Can someone give me some tips on how to insert data using this method? I've been toying around with it for some time, but I haven't had any luck so far
Hello, great tutorial!
I have a question: how can I access to single fields? something like this:
foreach($datas as $data) {
$username = $data["username "];
$password= $data["password"];
}
I'd like echo only Username o Password here: $leads->showAllLeads();
thanks!
Please use naming conventions. don't use getAllUsers, use getUsers, that way you can add an optional "limit" parameter so you don't overwhelm your database retriving 9 million users at once, name your users variable "users" because it contains User instances (not really because you didn't use class mapping, but it should), that way you know what the variable contains. If you name it "datas", fuck knows what's in that variable, plus you could have another variable with the same generic ass name later in your code.
Slim course?
No there will be more episodes. I'm currently moving and don't have my office for recording before the weekend.
Gotcha, keep it up!
how about: $database->query(SELECT * FROM users); ?
That is also a possible way to query :) However it is using PDO and not MySQLi like mentioned in the video title. In a later episode I go over PDO connections as well since PDO and MySQLi both have pros and cons ;)