Simon
Simon

Reputation: 305

Getting database data into a html table

I need to get the data of the database to an HTML table.

There were similar questions asked before but none of them were similar to my requirement.

I need to get the first row of the database to the first row of the table.

So I did this.

echo "<table id='main-table' border='1px solid'> <thead> ";
echo "<tr>";
                echo "<th>Board No</th>";
                 echo "<th>Number</th>";
 echo "</tr></thead><tbody>";

           while($query->fetch()){
                 echo "<form action='' class='' method='post'><tr>";
                   line 55 --> echo "<td>" . Board Code:".$row["board_code"] . Number:".$row["status"]  . "</td>";

                  echo "</tr> </form>";   
        }//End of While
  echo "</tbody></table>";

There is a syntax error in line 55 as mentioned above in the code.

Upvotes: 1

Views: 62

Answers (3)

Bhoomi Patel
Bhoomi Patel

Reputation: 775

Check this code:

echo "<table id='main-table' border='1px solid'> <thead> ";
echo "<tr>";
              echo "<th>Board No</th>";
               echo "<th>Number</th>";
echo "</tr></thead><tbody>";

         while($query->fetch()){
               echo "<form action='' class='' method='post'><tr>";
               echo "<td> Board Code:".$row["board_code"]. "</td>";
                echo "<td>Number:".$row["status"]. "</td>";
                echo "</tr> </form>";
      }
echo "</tbody></table>";

Upvotes: 3

Vaibhav Shettar
Vaibhav Shettar

Reputation: 810

Check with this code

echo "<form action='' class='' method='post'><tr>";
                   line 55 --> echo "<td>" . Board Code:".$row["board_code"] ." Number:".$row["status"]  . "</td>";

                  echo "</tr> </form>";   

Upvotes: 0

Asad
Asad

Reputation: 124

 "<td>" . Board Code:".$row["board_code"] ." Number:".$row["status"]  . "</td>";

edit your code like if it does not work please share your whole code will help you for sure

Upvotes: 0

Related Questions