Answering your questions separately:
How I get session data?
Using "pure php", do the following:
$_SESSION['valor']
For example: after the customer logs in, you play the client id in the session
$_SESSION['cliente']['id'] = $cliente->id;
$_SESSION['cliente']['nome'] = $cliente->nome;
// outros valores aqui
$_SESSION['logado'] = true;
How I use session data to find something related to them?
After setting the data in the session, on another page you want to search for something by customer id, then you would do something like this:
$cliente_id = $_SESSION['cliente']['id'];
Now just use the variable $cliente_id
where you wish (in your query for example):
$sql = 'SELECT id, placa, modelo, marca, valor
FROM veiculos
WHERE cliente_id < :cliente_id';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->bindParam(':cliente_id', $cliente_id, PDO::PARAM_INT);
$veiculos = $sth->fetchAll();
I used the table vehicles as an example, but in your case may be another.
Any questions leave a comment.
Useful links:
What is the structure of the "people table"?
– Dirty Old Man
Name, date of birth, address, city, country, mail, user pass
– Odacil