Here is my code:
class Sub extends DatabaseObject {
protected static $table_name="subs";
protected static $db_fields=array('id', 'product_id', 'col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8', 'col9', 'col10', 'col11', 'col12');
public $id;
public $product_id;
public $col1;
public $col2;
public $col3;
public $col4;
public $col5;
public $col6;
public $col7;
public $col8;
public $col9;
public $col10;
public $col11;
public $col12;
My find_subs_on($product_id) function calls another function that passes values into the public variables above.
My problem is that I want to display the values above in a table, with each col inside a <td>
Do I create a function inside the class that takes those values and returns an array, and then i foreach the array?
Do I create an array in the view, and pass in $sub->col1, $sub->col2 etc.?
I would love if someone could point to an example of the correct way to do this. Thank you very much for any help!