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 7782411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:32:08+00:00 2026-06-01T19:32:08+00:00

There are multiple blog entries and each should be shown once. There is a

  • 0

There are multiple blog entries and each should be shown once. There is a “comment” link that shows and hides the comments for every blog entry. I can’t figure out why the same first result keeps showing up. It happens every time I add a new comment (currently there’s 5 and the blog section is displayed 5 times and only the first comment is shown for each).
Based on whether the user is logged in the “comments” link either shows a a log in link or (if logged in) a form field to submit a comment.

<?php
$conn = mysql_connect("...", "...", "...");
mysql_select_db("...");
$result  = mysql_query("select * from blog");
$result2 = mysql_query("select * from blogcomment where blog.ID = blogcomment.blogID");
$i       = 1;
while ($row = mysql_fetch_array($result))
{
    echo "<h1>$row[title]</h1>";
    echo "<p class ='second'>$row[blog_content]</p> ";
    echo "<p class='meta'>Posted by .... &nbsp;&bull;&nbsp; $row[date] &nbsp;&bull;&nbsp; <a href='#' onclick=\"toggle_visibility('something$i'); return false\">Comments</a><div id='something$i' style='display: none;'><p class='third' >";
    $i++;

    while ($row = mysql_fetch_array($result2))
    {
        echo "$row[commentdate] &nbsp;&bull;&nbsp; $row[username]</p><p>said:</p> <p>$row[comment]</p>";
        if (isset ($_SESSION["gatekeeper"])) {
            echo '<form method="post" action="postcomment.php"><input name="ID" type = "hidden" value = "' . $row[ID] . '" /><input name="comment" id="comment" type="text" style="margin-left:20px;"/><input type="submit" value="Add comment" /></form></div>';
        }
        else {
            echo '<p class="third"><a href="register.html">Signup </a>to post a comment</p></div>';
        }
    }
}
mysql_close($conn);
?>
  • 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-06-01T19:32:09+00:00Added an answer on June 1, 2026 at 7:32 pm
    $i = 1; 
    while($row = mysql_fetch_array($result))
    {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to perform blog-detection where there are multiple Regions-of-Interest in a frame,
There are multiple values I have been storing in ASP.NET configSections sections for each
Is there a multiple instances pattern in F# somewhere? Consider that I'm working on
I have a project where there are multiple applications that have some common configuration
I'm writing a blog post that uses multiple videos from YouTube and Yahoo Video,
Are there any more generic tools that can compile or basically merge multiple PHP
Hello I want to Create a home page that has updating blog entries. So
In my web app, there are 5 different sections: Blog Display, Blog Entries list,
Why are there multiple (2) web.config files: 1 in the root directory 1 in
There are multiple ways to fill an NSTableView up with data through either bindings,

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.