PatrickLouys / no-framework-tutorial

A small tutorial to show how to create a PHP application without a framework.
MIT License
1.53k stars 188 forks source link

How i can use database? #49

Closed sahibkhan closed 8 years ago

sahibkhan commented 8 years ago

Hi Steve how i can using database.you known about my question is that how i can view database record and which packages use for that please share me about that i fellow your tutorial every things work fine .now i m connect to database and fetch the record from database so where i use database class and how i can do that please please

PatrickLouys commented 8 years ago

Sorry I did not find time yet to write that chapter.

You can set up a PDO instance that you can then inject into your classes that need to access the database. Have a look at the Table Data Gateway and the Repository pattern if you want some guidance on how a class that accesses the DB should look like.

sahibkhan commented 8 years ago

Lot of Thank Bro Steve to responsive me.But bro if you share me the database libraries just like for Error Handler filp/whoops you recommend that so there for please share me the libraries

PatrickLouys commented 8 years ago

http://php.net/manual/de/book.pdo.php

or if you want to get fancy

http://www.doctrine-project.org/projects/dbal.html

sahibkhan commented 8 years ago

Bro Steve i included that libraries doctrine using composer but bro the problem is that where i extend the model classes and where i created the model class and how i connect it to my application if u created that chapter for me just created one database and retrieve or insert data mean small demo about database connectivity its very helpful for me .Thanks Thanks Thanks again and again to response me

PatrickLouys commented 8 years ago

I am not "Bro Steve", if you want further help please talk in an appropriate manner.

You don't extend model classes. You should not have any "model classes" at all. Please read again what I wrote earlier (Table Data Gateway/Repository).

sahibkhan commented 8 years ago

sorry bro PatrickLouys for that comments may be you mind

MrBrax commented 7 years ago

I find it extremely confusing, with nowhere to begin. Done PHP stuff for 12 years but this just makes my brain slow to a crawl.