Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6127953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:34:17+00:00 2026-05-23T16:34:17+00:00

I have posts that are echoed out of my mysql database. If there is

  • 0

I have posts that are echoed out of my mysql database. If there is more than one, they are echoed in separate divs in order of decreasing rank number (taken from DB). However, when the divs are echoed, the all overlap on the top. I believe this is a CSS problem. The thing is that each div has several sub divs. I think the “position” attribute might have contributed to this. I would like for each div to be echoed out with about 100px between each one. Thanks.

CODE:

$post = array();
$f=0;
while ($row=mysql_fetch_assoc($g)){
  $post[]=$row['post'];

  echo "<div id='area'>";
  echo "<div id='badge'><span style='color: gray;'>Answered by:</span>";
  include 'badge.php';
  echo "</div>";
  echo "<div id='areapost'><pre>$post[$f]</pre></div>";
  $f++;
}
echo "</div>"; /*end area*/

CSS CODE:

#area {
  background-color: #fff;
  border: 1px solid red;
  width:500px;
  height: 300px;
}

#badge{
  position: absolute;
  top: 0px;
  left: 0px;
}

#areapost{
  position: absolute;
  top: 0px;
  right: 0px;
  height: 300px;
  width: 380px;
  background-color: #E0E0E0;
  overflow: -moz-scrollbars-vertical;
  overflow-x: hidden;
  overflow-y: scroll;
}

The “area” is the entire post container. The areapost and badge are elements inside “area”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:34:18+00:00Added an answer on May 23, 2026 at 4:34 pm

    You almost always need to open and close divs at the same level of looping. Here you are opening the <div id='area'> inside the while loop and closing it outside the while loop. They need to either both in, or both out. Also, your id’s ought to be unique, over your whole page, else you should be using classes on those divs.

    You also need to not position all these areas absolutely. I’ve added a content div around everything. Position this absolutely, and the area class relatively. You don’t need the styling on #area, change it to .area.

    $f=0;
    
    echo "<div id='content'>"
    while ($row=mysql_fetch_assoc($g)){
      $post[]=$row['post'];
    
      echo "<div id='area-'" + $f + " class='area'>";
      echo "<div class='badge'><span style='color: gray;'>Answered by:</span>";
      include 'badge.php';
      echo "</div>";
      echo "<div class='areapost'><pre>$post[$f]</pre></div>";
      echo "</div>"; /*end area*/
    
      $f++;
    }
    echo "</div>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that posts HTTP data and displays a UIAlertView if there
I have a homepage with four displayed posts and one that is emphasized. The
I have seen posts that show three ways to reset the DMV views: Reset
I have a table posts that could look like this: id | title |
Here's what I need to fetch: - posts that have comments - number of
I have read two recent posts that discuss Depends and Imports Upcoming NAMESPACE, Depends,
I have a loop of posts that I use infinite scroll to paginate. I
I have read in some of the ClickOnce posts that ClickOnce does not allow
I have a team site blog with many posts that I wish to export.
I have an application that posts data to a php script through jquery's ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.