vendredi 27 février 2015

include once inside echo

I have two headers which I'd like to display according to account type; "a" for admin type and "b" for regular user type. I already have the enum set 'a','b'. Now, for the php after connecting to the database, I have:



<?php
while ($row = mysql_fetch_array($sql)){
$name = $row["name"];
$accounttype = $row["accounttype"];
if($accounttype == "a"){
$header = include_once "header_a.php";
}
if($accounttype == "b"){
$header = include_once "header_b.php";
}
}
?>


As for the html, I have:



<html>
<body>

<?php echo $accounttype; ?>

</body>
</html>

Aucun commentaire:

Enregistrer un commentaire