I'm trying to do this thing.
If user is not logged, it will show him
https://i.stack.imgur.com/7X4nq.png this image as avatar. + login ahref
If user has session, it will show him Skins row. + logout ahref.
But when I'm doing "else" it shows me weird layout.
<?php
session_start(); //starting session
include("config.php"); //including our config.php
error_reporting(E_ALL);
if(isset($_SESSION['username'])) //if session is set, so if user is logged in...
{
$username = $_SESSION['username']; //setting variable username as one from session
$query = mysql_query("SELECT * FROM users WHERE username = '$username'");
while($row = mysql_fetch_assoc($query)) //looping thousgt table to get informations
{
$Skin = $row['Skin'];
}
} else
echo " <li class='second admin-pic'>
<ul class='top_dp_agile'>
<li class='dropdown profile_details_drop'>
<a href='' class='dropdown-toggle' data-toggle='dropdown' aria-expanded='false'>
<div class='profile_img'>
<span class='prfil-img'><img src='https://i.stack.imgur.com/7X4nq.png' alt=''> </span>
</div>
</a>
<ul class='dropdown-menu drp-mnu'>
<li> <a href='#'><i class='fa fa-cog'></i> Log IN</a> </li>
<li> <a href='#'><i class='fa fa-user'</i> Make new Account</a> </li>
</ul>
</li>
</ul>
</li>";
?>
and this is html
<li class="second admin-pic">
<ul class="top_dp_agile">
<li class="dropdown profile_details_drop">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<div class="profile_img">
<span class="prfil-img"><img src="images/<?php echo $Skins ?>.jpg" alt=""> </span>
</div>
</a>
<ul class="dropdown-menu drp-mnu">
<li> <a href="#"><i class="fa fa-cog"></i> Logout</a> </li>
<li> <a href="#"><i class="fa fa-user"></i> Forum</a> </li>
</ul>
</li>
</ul>
</li>
Shall I define $skins if is >1 (avatars will be named numeric) to show html and then instead of that HTML just to replace it with echo $skins ?
What I want to remove HTML for good and replace it just with echo, ex.
if($Skins > '0') {
$Skins = "<li class='second admin-pic'>
<ul class='top_dp_agile'>
<li class='dropdown profile_details_drop'>
<a href="#" class='dropdown-toggle' data-toggle='dropdown' aria-expanded='false'>
<div class='profile_img'>
<span class='prfil-img'><img src='images/<?php echo $Skins ?>.jpg' alt=''> </span>
</div>
</a>
<ul class='dropdown-menu drp-mnu'>
<li> <a href=''><i class='fa fa-cog'></i> Logout</a> </li>
<li> <a href=''><i class='fa fa-user'></i> Forum</a> </li>
</ul>
</li>
</ul>
</li>";}
and html
// another divs, etc.
?php echo $Skins ?>
new divs
is this good way ? because now it's showing exactly this way