Welcome Guest, Not a member yet? Register   Sign In
Extending DB record
#1

[eluser]crumpet[/eluser]
Is there a reason the db record class doesn't have a search function. Like if I already have retieved results for something and want to search through them to see if somethings there the fastest way I can see to do so is this
Code:
$found = FALSE;
$i = 0;
do{
    if ($searchID == $query->row($i)->ID)
    {
        $found = $query->row($i)->title;
    }
    $i++;
} while ($i < $query->num_rows());

is there a reason they didn't put this in? any advice on this code if i were to put it into my own db_result class as a $query->search($field, $search_value, $return_field) ?
#2

[eluser]gstjohn[/eluser]
I, personally, would say that it's not in there because typically you would add your search parameters to the query and allow the database engine to find it for you rather than looping through a set of results. If there are no returned results, it didn't find it.




Theme © iAndrew 2016 - Forum software by © MyBB