Query A Database Using PDO In OOP PHP | Object Oriented PHP Tutorial | PHP Tutorial | mmtuts

Query A Database Using PDO In OOP PHP | Object Oriented PHP Tutorial | PHP Tutorial | mmtuts

Dani Krossing

6 лет назад

66,882 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

foreign- living the american dream
foreign- living the american dream - 12.07.2023 00:55

up to present day, this video is a big help. saved me on going on a 4th day searching..

🙏

Ответить
Steph Digital Designs
Steph Digital Designs - 31.03.2023 21:11

how do you turn the values into a variable and echo them out on page with list of users

Ответить
John Dislins
John Dislins - 12.02.2023 21:52

in the User class, using 'return' gives me only the first uid, using echo it shows them all

Ответить
محمد & mohammed
محمد & mohammed - 24.11.2022 20:14

you dont need to execute the statement ?

Ответить
B
B - 20.01.2022 19:37

I'm here! 😎 Great video, just posting a comment to show some support! Keep up the good work. 🤙

Ответить
Jean Darly Bumerangue
Jean Darly Bumerangue - 11.01.2022 04:40

//my code

public function insertProd($name){
$this->n=$name;
$this->setDBName("dbProd");
$stmt = $this->connect()->prepare
('
INSERT INTO tblProd
(
name
)
VALUES
(
:n
)
');

//idProd = auto increment

$stmt->bindParam(':n' , $name);
$stmt->execute();
/* return last_insert_id(); <--- I don't know =( */
}

Ответить
Jean Darly Bumerangue
Jean Darly Bumerangue - 10.01.2022 18:33

Hello my friend! How to get last_insert_id()? thanks!

Ответить
Wilbert Raymund Rayos
Wilbert Raymund Rayos - 06.11.2021 09:49

Good Day,
May I ask, is it fine if I don't close the cursor?
Thanks

Ответить
mohamed nassim
mohamed nassim - 09.08.2021 04:03

cool

Ответить
CodeWithRu
CodeWithRu - 01.04.2021 15:55

I learn a lot of things Thanks

Ответить
Andres Rivera
Andres Rivera - 05.03.2021 21:02

You confused me with the order that you have your videos.

Ответить
Satish Verma
Satish Verma - 10.12.2020 23:01

very nice ..

Ответить
rouziuzi
rouziuzi - 10.05.2020 06:12

Thank you so much. You helped me a lot. I have learned a lot of programming languages, but this helps me a lot in all of them.

Ответить
Sebastien Serra
Sebastien Serra - 18.03.2020 13:22

Thanks for your tutorials, they are quite useful, and you explain well!

Ответить
Raahim Fareed
Raahim Fareed - 12.03.2020 06:30

I can't find the playlist for PDO. Can anyone link that to me?

Ответить
Clemens H
Clemens H - 10.02.2020 17:31

Does it really make sense that the User extends the Dbh class. Yes for functionallity of curse but I mean a user hasn't something to do with a DB. And what is when I want the user Class to extends another class like the class Sepecialuser or something like that I can onky extend from one class so when every class which have something to do with Database extends from the Database Class that would be a Problem

Ответить
Shailesh Chotoe
Shailesh Chotoe - 23.01.2020 21:10

why do you let user extend from dbh? user isnt a database ?

Ответить
Hippo T
Hippo T - 19.12.2019 17:50

Why do you use a while loop on the "getAllUsers()" method? It will only return the first result since nothing after a return is processed. Seem's a bit odd to do it like this?

Ответить
Mubeen Saiyed
Mubeen Saiyed - 02.09.2019 09:56

when is your next oop tutorial coming up i am waiting.....plz

Ответить
Pinkky Der
Pinkky Der - 01.08.2019 09:27

I like watching your tutorials a lot.
I just finished to BCT education College high diploma.
I want to study it about your OOP lesson.
but I don't have money and don't have a bank account.
Please help me.
I have to work for my family.
I don't need much.
I want to study about insert, update, delete or get variable in form to database.
Please call me(+856 20 5531 9304) or send E-mail to me([email protected])
Thank You.

Ответить
Christian Achleitner
Christian Achleitner - 06.07.2019 14:38

Since we are back to php - would you consider to start with the social network again? :) Your fans are waiting for this already so long ;)

Ответить
Onslaugth
Onslaugth - 24.06.2019 13:00

How to integrate a template with OPP?

Ответить
shortsdeliveries
shortsdeliveries - 22.06.2019 04:59

whoohowwww!! i survived the entire course! thank you!

Ответить
Sikiru Ajayi
Sikiru Ajayi - 20.06.2019 14:08

TO be honest, you have really opened my eyes to programming, I have not been able to create a project all these years
but within 5mnth I knew your page, I have been able to!
thanks thanks thanannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnks...
Also ...kindly help US with a complete PHP OOP PDO Login system

Ответить
Jan Pedersen
Jan Pedersen - 10.06.2019 14:36

What i need with this tutorial is use cases, how can this be put into use and not something really big.. just the simple how to read from a database, or how to display data from an array into index.html using principle of oop php and how to avoid the traps of creating classes/ functions who become specific and cant be reused ;) if you wanna do bigger stuff then include mysql as almost all uses that for websites or data they wanna show into their websites.

Ответить
Fataidea
Fataidea - 04.06.2019 01:50

Thanks too you mmtuts will be anticipating your subsequent tuts

Ответить
Jonatan
Jonatan - 26.05.2019 12:37

dude. you are a ANGEL. =) this tutorial worked perfectly for my site! i'll be sure to put a link to this in my readme-doc.

Ответить
crack
crack - 03.03.2019 17:31

PLZ UPLOAD MORE PHP ADVANCE TUTORIAL!!!

Ответить
Smile_Brighter
Smile_Brighter - 01.03.2019 13:01

You're saving my life here, thanks for these awesome tutorials!!

Ответить
Aun Mohammad
Aun Mohammad - 28.02.2019 14:50

Plz continue advance PHP course with project.

Ответить
Sounds of World
Sounds of World - 21.02.2019 05:19

hey man! I learned so much thing from your videos, but i realized you didn't push new one? why did you stop ?

Ответить
Jassue
Jassue - 20.02.2019 04:09

Hello, I copied all the same codes but different database and table name and attributes however I am getting this error "Fatal error: uncaught error: call to a member function query() on null in C:\xxamp\htdocs\test\user.inc.php:16 Stack trace: #0 C:\xxamp\htdocs\test\index.php(19) User->getAllUsers() #1 {main} main thrown in C:\xxamp\htdocs\test\user.inc.php on line 6.

Please help me, on fixing this error. Thank you.

Ответить
JAMAL AL
JAMAL AL - 17.02.2019 16:41

thank you so much

Ответить
ms violin
ms violin - 15.02.2019 12:43

That is part 14, right? I can't find part 1 to 13. Could you support me the links for those parts?

Ответить
slapmyfunkybass
slapmyfunkybass - 05.02.2019 22:55

Thanks for the video series. You’ve helped a great deal and explained it well. I think it’s only right I donate something for your time. Please advise how.

Ответить
Saqlain Alvi
Saqlain Alvi - 25.01.2019 20:05

Beasted through these videos in about 2hrs. But to be fair, i already had some OOP experience. Best of luck to everybody!

Ответить
Grosu Cosmin Ionut
Grosu Cosmin Ionut - 17.01.2019 14:35

will you continue this series? Or this is all there is to it?

Ответить
Kimani H
Kimani H - 07.01.2019 02:18

Thank you sir, i was so lost with other tutorials and guides but now i understand exactly what's going on. God bless you.

Ответить
abzalom kyeuw kyeuw
abzalom kyeuw kyeuw - 03.01.2019 22:32

i getting some error message:
Fatal error: Uncaught PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected
how to fix it?

Ответить
Harold Zwartnego
Harold Zwartnego - 29.12.2018 02:22

I was quite stuck at learning OOP PHP and also the PDO part. Really helpfull and clear explained. Going trough the last part again as I did the series all at once at night. So focus was a little bit lost. Thanks and let see if you have more of these :) !

Ответить
Dominik Ježík
Dominik Ježík - 28.12.2018 18:58

Pleas more oop php videos.

Ответить
RandomSilly
RandomSilly - 22.12.2018 04:10

Can someone please tell me why php is a meme?

I see that he's inheriting from Dbh class, but why?

I'm pretty new to web dev, coming from C/C++ and I'm kinda confused why you inherit from the DB.

Couldn't you just make it like a singleton and use it to connect and query? I know he's doing it OOP style, but I've never seen this before lol

Reason I'm asking is if you wanted to have a class extending from another class. For example Car extends Vehicle. With this approach (assuming here php doesn't allow multi-inheritance), you would not be able to do such a thing.

Ответить
شادي جعفر Shadi Gaafar
شادي جعفر Shadi Gaafar - 10.12.2018 20:11

thank you for your efforts

Ответить
thewindburner
thewindburner - 23.11.2018 12:06

Enjoyable tutorial!


Can I ask a question, in some of the MVC I've looked at they return the data from the class then do the for or while loops on the view, why do you do a for loop (or while loop) to output the data in the class?

Ответить
恩醬 TV
恩醬 TV - 27.10.2018 20:04

Good video.
Need more about mysqli OOP and select, delete or other.

Ответить
Roberto Font
Roberto Font - 14.10.2018 15:58

I​ did that same thing and it did not do anything can you help?

Ответить
Ruphus Joseph Xavier
Ruphus Joseph Xavier - 02.10.2018 05:21

Thank you Bro. 👍 for ur hardwork .

Ответить
Md . Shakib Hassan
Md . Shakib Hassan - 22.09.2018 17:05

I am getting this error, please help :
Fatal error: Uncaught PDOException: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected in C:\xampp\htdocs\dbconnect_pdo\includes\getuser.inc.php:29 Stack trace: #0 C:\xampp\htdocs\dbconnect_pdo\includes\getuser.inc.php(29): PDOStatement->execute(Array) #1 C:\xampp\htdocs\dbconnect_pdo\index.php(22): getUser->getUserWithCountCheck() #2 {main} thrown in C:\xampp\htdocs\dbconnect_pdo\includes\getuser.inc.php on line 29

Ответить
The Code School
The Code School - 05.09.2018 21:57

Great video!

Ответить