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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:38:04+00:00 2026-05-30T07:38:04+00:00

I am a few stages further in learning PHP but I have come to

  • 0

I am a few stages further in learning PHP but I have come to another annoying pit stop. I have a really simple bit of code that retrieves book items from my database. I am displaying them in an html table however because it is a loop, if I use the th tags for table header I get a header above every single data item!

Here is my code extract: (as you can see I have put my th tags as comments as that doesn’t work)

<table border="0">
<br />
<?php
$count = 0;
while ($count < $numrow)
{
    $row = mysql_fetch_array($results);
    extract($row);

    echo "<tr>";

    //echo "<tr>";
    //echo "<th>";
    //echo "Book Title";
    //echo "</th>";
    //echo "<th>";
    //echo "Book Author";
    //echo "</th>";
    //echo "<th>";
    //echo "Book Publisher";
    //echo "</th>";
    //echo "<th>";
    //echo "Book ISBN";
    //echo "</th>";
    //echo "</tr>";

    echo "<td>";
    echo "<a href='addtolist.php?     bookname=".$bookname."&bookauthor=".$bookauthor."&bookpub=".$bookpub."&bookisbn=".$bookisbn."'>[+]</a>";

    echo "</td>";

    echo "<td>";
    echo $bookname;
    echo "</td>";

    echo "<td>";
    echo $bookauthor;
    echo "</td>";

    echo "<td>";
    echo $bookpub;
    echo "</td>";

    echo "<td>";
    echo $bookisbn;
    echo "</td>";

    echo "<td>";
    echo "<a href='deletecd.php?bookname=".$bookname."'>Delete</a>";
        echo "</td>";

    echo "</tr>";

    $count = $count + 1;

}
?>
  • 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-30T07:38:05+00:00Added an answer on May 30, 2026 at 7:38 am

    Move those echos out of your loop. Also, you shouldn’t have a <br /> directly inside of a <table> tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been thru a few questions but did not find an answer. I
Quite simple: Other than ConcurrentDictionary (which I'll use if I have to but it's
A few individuals at my work have come together to form a group whose
I have a few code files that are in incremental stages of development. i
I have a few questions about security using PHP, I dont want to use
Few basic doubts I have: 1. Is primary key column automatically indexed? 2. What
I have few global methods declared in public class in my ASP.NET web application.
I've found a few questions on modelling many-to-many relationships, but nothing that helps me
I'm attempting to write a simple B+tree implementation (very early stages). I've got a
I have a node set up with a few workflow states. The first state,

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.