I met some trouble with a function I have written.
In fact I have an array in which I have different custom values.
I would like to display the result of that, so here is my function
function getAccess($var){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `acces` WHERE `id`='.$var.'"));
return $data;
}
getAccess($_SESSION['id']);
$paramAcces = array(
'comptesfinanciers' => array(
'libelle' => 'COMPTES FINANCIERS',
'acces' => $data['comptesfinanciers'],
'lien' => 'financier',
'image' => 'images/finances.png'
)
);
I have done a var_dump of $paramAcces which return
array(1) { ["comptesfinanciers"]=> array(4) { ["libelle"]=> string(18) "COMPTES FINANCIERS" ["acces"]=> NULL ["lien"]=> string(9) "financier" ["image"]=> string(19) "images/finances.png" } } (that are the ecpected values).
Here is the function for displaying what is in the array
/**
* AFFICHAGE DE LA SECTION PARAMETRES SUR LA PAGE D'ACCUEIL
*/
function affichParam($paramAccees){
echo '<ul class="getcash-vmenu"><li><a href="index.php?p='.$paramAccees['lien'].'" class="active"><span class="t"><img src="'.$paramAccees['image'].'"> '.$paramAccees['libelle'].'</span></a></li></ul>';
}
The trouble is that actualy it return to me an empty line.
I really do not know what I'm wrong doin:
I call the function like that:
<?php
affichParam($paramAccees)
?>
In a second time I will add more value, so I think I will have to do a for each loop or something like that.
But actualy I just would like to display the first record.
Any kind of help will be much apprecitaed
lien
is apart of the comptesfinanciers
array which is apart of the paramAccees
array, which should be reflected as so:
echo '<ul class="getcash-vmenu"><li><a href="index.php?p='.$paramAccees['comptesfinanciers']['lien'].'" class="active"><span class="t"><img src="'.$paramAccees['comptesfinanciers']['image'].'"> '.$paramAccees['comptesfinanciers']['libelle'].'</span></a></li></ul>';