conan318 Posted August 9, 2011 Share Posted August 9, 2011 i am having a css problem where i am trying to pull mutable records from the database but they wont display right. i need them to display vertically one under the next. atm there displaying kinda on top of each other the css. thank you .next_rideb{ width:200px; border-style:groove; margin-left: 750px; margin-top:455px; } .next_ride{ width:200px; background-color:#FFF; border-style:groove; padding: 5px; position:absolute; } The Php <div class="nextrideb"> <?php $dMonth = $_REQUEST["month"]; $dYear = $_REQUEST["year"]; $data = mysql_query("SELECT * from main.mbadmin WHERE mbadmin.month=$dMonth AND mbadmin.year=$dYear ORDER BY day DESC LIMIT 10;") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { Echo "<div class='next_ride'>"; Echo "Next Ride Updated On"; Echo "<br>"; echo $info['mk'] ; echo "<hr>"; echo "<br>"; Echo $info['nextride'] ; Echo "<br>"; Echo "<hr>"; Echo "</div>"; } echo "<br>"; ?> </div> <?php Quote Link to comment https://forums.phpfreaks.com/topic/244361-php-and-css-help/ Share on other sites More sharing options...
cssfreakie Posted August 9, 2011 Share Posted August 9, 2011 That's because your using position absolute. I recommend you output your items in a list for instance like so. <?php echo '<ul class="items">'; foreach($array as $value){ echo '<li>'.$value.'</li>'; } echo '</ul>'; ?> than in css you can style this list because you gave the UL a class of items. for instance .items{list-style:none;} P.s. this is the wrong forum to fix php logic. This is just for fixing how it is being styled in css Quote Link to comment https://forums.phpfreaks.com/topic/244361-php-and-css-help/#findComment-1255097 Share on other sites More sharing options...
Guber-X Posted August 9, 2013 Share Posted August 9, 2013 could try add "clear: both" to your CSS tags Quote Link to comment https://forums.phpfreaks.com/topic/244361-php-and-css-help/#findComment-1444100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.