question using $db = Loader::db();
Permalink
Hi! I was wondering how I could bring about the next issue.
I have created an XML file to hold a database model for a block.
Inside this database model there is a table that I created called
BtProductInformation with a field name called fIDpicture.
The field fIDpicture is used to store an image inside the database.
Obviously I want this image to show (and turn the fIDpicture into an actual picture).
I started writing a function in the controller.php to achieve something like this, but I got stuck..
or should it be done with something like this?
Thanks in advance for someone who could help me out with this!
I have created an XML file to hold a database model for a block.
Inside this database model there is a table that I created called
BtProductInformation with a field name called fIDpicture.
<table name="btProductInformation"> .... <field name="fIDpicture" type="I"></field>
The field fIDpicture is used to store an image inside the database.
Obviously I want this image to show (and turn the fIDpicture into an actual picture).
I started writing a function in the controller.php to achieve something like this, but I got stuck..
function getPicture() { $db = Loader::db(); $rs = $db->Execute('SELECT bfIDpcitrue FROM btProductInformation bpi WHERE categoryID = ?)
or should it be done with something like this?
function getPicture() { if ($this->fIDpicture > 0) { return File::getByID($this->fIDpicture); } return null; }
Thanks in advance for someone who could help me out with this!