I have two files : - The first is where my sql query are defined - The second where I call the function
Here is my code from the first file :
function select_categories($pdo){
$sql = 'SELECT * FROM categories ;';
$query = $pdo->prepare($sql);
$query->execute();
$tableau = $query->fetchALL(PDO::FETCH_ASSOC);
return $tableau;
}
And here is the code from my second file :
<?php
include('includes/sql.php');
function liste_categories(){
echo select_categories($tableau);
}
?>
I have to display my categories in a HTML list but for the moment I get an error "Undefined variable: tableau in /iut/users/vogel/public_html/info2/Galerie/includes/affichage.php on line 5"