• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Alignment to the right - PHP/HTML

feruupl

New Member
Joined
Jul 22, 2014
Messages
2
Reaction score
0
Hello,
I have a small problem that I cannot deal with - how can I alignment the $exp to the right in powergamers box? It's sticked next to the names, but I don't want to..

2a6507e9ce8f1.png


Powergamers code that I use:

Code:
					<?php
					$powergamers = $SQL->query("SELECT name, experience, exphist_lastexp FROM players WHERE group_id < 2 ORDER BY  experience - exphist_lastexp DESC LIMIT 5;");
					?>
					<div class="col-3 pull-right">
						<div class="well">
								<tbody><div class='bg'>
								<?php
                    foreach($powergamers->fetchAll() as $player) {
                        $exp = ($player['experience']-$player['exphist_lastexp']) / 1000;
                        $name = $player['name'];
                                if (strlen($name) > 10)
                                {$name = substr($name, 0, 9) . '..';}
                echo '                
                <ul>
                    <li><a href="?subtopic=characters&name=' . $player['name'] . '">' . $name . '</a>&nbsp;<span class="label label-' . ($exp >= 0 ? 'success' : 'error') . ' pull-right">' . ($exp >= 0 ? '+' : '-') . round($exp) . 'k</span></li>
                </ul>
				';
                    }
                ?>
 
Solution
PHP:
                    <?php
                    $powergamers = $SQL->query("SELECT name, experience, exphist_lastexp FROM players WHERE group_id < 2 ORDER BY  experience - exphist_lastexp DESC LIMIT 5;");
                    ?>
                    <div class="col-3 pull-right">
                        <div class="well">
                                <tbody><div class='bg'>
                                <?php
                    foreach($powergamers->fetchAll() as $player) {
                        $exp = ($player['experience']-$player['exphist_lastexp']) / 1000;
                        $name = $player['name'];
                                if (strlen($name) > 10)
                                {$name = substr($name, 0, 9) ...
PHP:
                    <?php
                    $powergamers = $SQL->query("SELECT name, experience, exphist_lastexp FROM players WHERE group_id < 2 ORDER BY  experience - exphist_lastexp DESC LIMIT 5;");
                    ?>
                    <div class="col-3 pull-right">
                        <div class="well">
                                <tbody><div class='bg'>
                                <?php
                    foreach($powergamers->fetchAll() as $player) {
                        $exp = ($player['experience']-$player['exphist_lastexp']) / 1000;
                        $name = $player['name'];
                                if (strlen($name) > 10)
                                {$name = substr($name, 0, 9) . '..';}
                echo '               
                <ul>
                    <li><a href="?subtopic=characters&name=' . $player['name'] . '">' . $name . '</a>&nbsp;<span class="label label-' . ($exp >= 0 ? 'success' : 'error') . ' pull-right" style="float: right;">' . ($exp >= 0 ? '+' : '-') . round($exp) . 'k</span></li>
                </ul>
                ';
                    }
                ?>
 
Solution
Back
Top