Welcome Guest, Not a member yet? Register   Sign In
how do I represent a collection of models?
#1

[eluser]jared4444[/eluser]
I have records in database table called payments. I have a model called payments_model which has the same fields as the db. I have a function in the model that gets a payment from the db by id

function getpaymentbyid($id)
if ($query->num_rows() > 0)
{
$row = $query->row();
$this->ID = $row->ID;
$this->name = $row->name;


How do I get more than one row in the db and return that? Do I make a model which contains an array of this model? Is there another option?
#2

[eluser]The Casual Bot[/eluser]
if it gets the record by the id the id should be unique??

if you get lets say the invoices from today

then you would return
Code:
$query->results
#3

[eluser]überfuzz[/eluser]
@jared - You could always show us the query. Might be easier to help you then.




Theme © iAndrew 2016 - Forum software by © MyBB