quero armazenar todos os registros das minhas tabelas dentro de uma session
, quando eu chamo meus registros ele só puxa 1 resultado
class CRUD extends Config {
private $query;
private function prepExec($prep, $exec) {
$this->query = $this->getConn()->prepare($prep);
$this->query->execute($exec);
}
public function select($fields, $table, $prep, $exec) {
$this->prepExec("SELECT ".$fields." FROM ".$table." ".$prep."", $exec);
return $this->query;
}
}
tentei assim
index.php
session_start();
$not = $crd->select('*', 'noticias', 'ORDER BY id DESC', array());
foreach ($not as $reg) :
$_SESSION['slug_noticia'] = $not['slug_noticia'];
$_SESSION['nome_noticia'] = $not['nome_noticia'];
endforeach;
e assim
$not = $crd->select('*', 'noticias', 'ORDER BY id DESC', array());
foreach ($not as $reg) :
$_SESSION['reg'] = $reg;
endforeach;