• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extending DB record

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
$found = FALSE;
$i = 0;
    if ($searchID == $query->row($i)->ID)
        $found = $query->row($i)->title;
} 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) ?

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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.