Category : class

I am getting this error Uncaught Error: Call to a member function getId() on null in <?php require_once(‘includes/bootstrap.php’); require_once(‘header.php’); $entries = Entry::find("SELECT * from `entries` ORDER BY date DESC LIMIT 6"); if(count($entries) > 0) { $lastEntry = array_shift($entries); $category = Category::find("SELECT * from `categories` WHERE id = :id", [‘id’ => $lastEntry->getCatId()]); $category = array_shift($category); echo ..

Read more

I have this "reference code" in a separate div and I want to insert it beside the page title in the 2nd code: is it possible ? <div class="col-xs-<?php echo $headCol ?>"> <h3 class="inv col"><b><?php echo lang("reference"); ?>: </b><?php echo $invoice->reference; ?></h3> </div> Inside this one $etat_header .= ($show_center_title?("<center><h3 class="page-title">".$page_title."</h3></center>"):""); Sourc..

Read more

<?php class MyBookObject { private $summary; private $author; private $title; private $location; function __construct($location) { $this->location=$location; } function set_summary($summary) { $this->summary=$summary; } function set_author($author) { $this->author=$author; } function set_title($title) { $this->title=$title; } function get_summary() { return $this->summary; } function get_author() { return $this->author; } function get_title() { return $this->title; } function get_location() { return $this->location; ..

Read more

I am trying to get into classes in PHP and I am basically trying to create a new instance and assigning values to the new object. Here’s a minimal reproducible example: class Example { public $foo; private $bar; public static function createNew($someData){ $newObject = new static; $newObject->import_values($someData); return $newObject; } private function import_values($someData){ $this->$foo = ..

Read more