How to make a dynamic table in PHP?

Does anyone know to do make a very simple table using PHP?

  • the simpler the better, with a boarder.

  • Answer:

    First, figure out the html markup for the table you want, then use php echo statements to output your html. However, depending on what you're doing, you can also simply write html for the table tags, and use php to echo the contents of the table cells: <table> <tr> <td> <?php echo 'hello'; ?> </td> </tr> </table> Or if you're doing something like looping through mysql query results - <table> <?php foreach ($results as $result) { echo '<tr><td>'.$result.'</td></tr>'; } ?> </table> It really depends on what you're trying to accomplish. Oh, and to add a border - <table style="border: 1px solid gray;">

NWMXDCJTL2PEW5XJOZ7ZH7JPFM at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

<?php echo '<table>'; echo '<tr>'; echo '<td>'; etc. ?>

Colanth

dont think u can.... think u have to use html.... I mean u can do it in a php document, but put in html tags for the table

James J

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.