CI4 Tutorial Database Question |
I'm new to CI, and I'm working through the CI4 tutorial. I'm at the end of the news section, and the three entries I put in the database are not showing up in the view. I see the output for no entries in the database.
How do I check the connection to the database to make sure there are no issues with it? I pulled up PHPMyAdmin to look at the table, and it has the three entries I entered into it. Thank you.
Did you configure ./app/Config/Database.php to setup you database server?
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
<?php namespace App\Models;
use CodeIgniter\Model; class Blabla extends Model{ public function exfunc(){ $db = \Config\Database::connect(); $query = $db->query('SELECT blabla FROM blabla where blabla '); $results = $query->getResultArray(); return $results; } } A practise way for use database model in CI4. Sercan YANBULOGLU
SEO links REDACTED, per forum policy
@ProfessionalCoder,
CodeIgniter 4 Model already has the automatic database connection. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(11-30-2019, 05:28 AM)InsiteFX Wrote: @ProfessionalCoder, Thx I rewrite $db to $this->db->query Sercan YANBULOGLU
SEO links REDACTED, per forum policy
|
Welcome Guest, Not a member yet? Register Sign In |