So I was creating a login or not kind of display in php using this code: <?php if(file_exists('account/users/' . $_SESSION['username'] . '.xml')){ echo "<a style='float: right;' href='account'><?php echo $_SESSION['username'];?></a>"; } else { echo "<a style='float: right;' href='account'>Login or Register</a>"; } ?>
But instead it says: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /storage/ssd3/099/21080099/public_html/index.php on line 22
I tried adding a space from here echo "<a style='float: right;' href='account'><?php echo $_SESSION['username'];?></a>";
but it says this: Notice: Array to string conversion in /storage/ssd3/099/21080099/public_html/index.php on line 22
source https://stackoverflow.com/questions/77033557/php-not-echoing-array-to-display-usernames-in-000webhost
No comments:
Post a Comment