0

I've run into the problem that when I echo information Into a table using PHP and HTML from the database the information moves depending on how it loads.

By this I mean if I constantly refresh everything will be different to how it previously was. I mean how it is displayed not what is displayed.

.tracklist {

}
.tracklist img {
max-width:15%;
max-height:15%;
}
.tracklist td{
width:36%;
display:block;
padding:1%;
text-align:center;
}

#content {
width:98%;
height:73%;
padding-left:1%;
padding-right:1%;
background-color:#d8d8d8;
text-align:center;
}
#contentbox {
border-radius: 15px; 
-moz-border-radius: 15px; 
-webkit-border-radius: 15px; 
text-align:center;
background-color:#999999;
}

<div id="content">
<div id="contentbox">
<br />
<table class="tracklist">
<?php


        $i = 0; $trEnd = 0;
        while ($row = mysql_fetch_array($result)){
            if($i == 0){
                echo '<tr>';
            }
            echo '<td>';
                echo $row["genre"]." | ".$row["artist"]." | ".$row["name"];
                echo '<br />';
    echo "<img src=".$row["image"].' />';
        echo '</td>';
            if($i == 2){
                $i = 0; $trEnd = 1;
            }else{
                $trEnd = 0; $i++;
            }
            if($trEnd == 1) {
                echo '</tr>';
            }
        }
        if($trEnd == 0) echo '</tr>';

?>
</table>
</div>
</div>

The data from the database is called in the header just so people know that it is called.

1 Answer 1

1

Fixed this by putting width:100%; in the class which it inherited the height from.

Seems to of fixed it for now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.