Welcome Guest, Not a member yet? Register   Sign In
$db is confusing in the docs.
#2

works though consider :
Code:
public function getCountByCategory($category)
    
    {
          $db      = \Config\Database::connect();
//  from memory it gets from /app/config/Database.php
         $fields= $db->getFieldNames('products');
         var_dump($fields);

// output was array(7) { [0]=> string(2) "Id" [1]=> string(5) "image" [2]=> string(10) "imageTitle" [3]=> string(4) "slug" [4]=> string(8) "category" [5]=> string(4) "info" [6]=> string(5) "price" }
CMS CI4     I use Arch Linux by the way 

Reply


Messages In This Thread
$db is confusing in the docs. - by erlingdoyle - 07-28-2022, 09:02 AM
RE: $db is confusing in the docs. - by captain-sensible - 07-28-2022, 11:24 AM
RE: $db is confusing in the docs. - by kenjis - 07-28-2022, 04:00 PM
RE: $db is confusing in the docs. - by kenjis - 07-29-2022, 12:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB