Ishq Mehta Ishq Mehta - 1 year ago 77
PHP Question

How do I position the content of a 'while' loop on the top right corner?

I have a list of names that are fetched from a

loop coded in PHP.
When I try to display the content of the loop which is embedded in a div, the content gets overlapped.
The style I am using for the content is:

position: absolute;
top: 0px;
right: 0px;

Here is the entire code of the loop content along with style of the div in PHP:

$result2 = mysql_query("SELECT `player_name` FROM `player_data` WHERE `team_id`=$team2");

while($row = mysql_fetch_assoc($result2))
$name2 = $row['player_name'];
echo "<div id='cap'>";
echo "" . $name2 . "<br/>";
echo "</div>";

How do I get this content $name2 not overlapped?

Answer Source

Something like this:

echo '<div id="cap">';
while($row = mysql_fetch_assoc($result2))
    $name2 = $row['player_name'];
    echo '<div class="player">';
    echo $name2;
    echo '</div>';
echo '</div>';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download