• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can't create instance of a model class in models from controller class

#7
a model is just a class , after reading namespace primer i simply created another directory within app

i'm starting with keeping things simple ( i'm only playing with CI4 at this stage) using

<?php namespace App\Andy;
use CodeIgniter\Database\ConnectionInterface;

class DoStuff

{
protected $title;
protected $article;



public function index()
{
$db = \Config\Database::connect("default");

$query = $db->query("SELECT * FROM blog");
$row = $query->getRowArray();
return $row['title'].$row['article'];


}



i can retrieve from sqlite database ; i can also insert into database
Reply


Messages In This Thread
RE: can't create instance of a model class in models from controller class - by captain-sensible - 12-09-2019, 07:27 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.