Example: SELEC It has three names, I want to print these 3 names in another page.
pagina1.php
<?php
session_start();
include_once("config.php");
?>
<?php
$sql = $db->query("SELECT nome FROM banco_de_dados");//SELECT TEM 3 nomes (vitor,matheus,carol)
?>
<?php
while($dados = $sql->fetch_array()){
$nome = $dados['nome'];
$_SESSION['nome'] = $nome;
};
?>
page2.php
<?php
session_start();
$nome = $_SESSION['nome'];
echo $nome;
?>
print on page:
vitor
matheus
carol