0
Hello, I have a class that performs a query in the database:
$itemObra->listarItensObra($_GET['id'], 0);
I need to use this query several times and I would like the query to occur only once and the items to be stored in an array, and then use a foreach
to list.
foreach ($itemObra->listarItensObra($_GET['id'], 0) as $item) {
//....
}
Any idea is welcome!
Just play in a variable,
$lista = $itemObra->listarItensObra($_GET['id'], 0);
– rray
If you think about the architecture you can use the Singleton Pattern
– Jonatan Ribeiro dos Santos