Re: How to display database table data in a html table.



McGowan schreef:
Hi, I'm trying to display data from a mysql database in a HTML table
but for some reason my code isn't working. At the moment I have got it
to read and display the headers and the first row of the table and it
actually creates the remaining rows in the html table but it doesn't
put any data in them. This is my code so far:

I used this code once ... There are faster ways but I really dont use tables anymore so I never rewrote the code.


// table top
echo '<table width="800">';

// first row contains table headers (not using th)
echo '<tr>';
foreach ($allheaders as $header)
{
echo '<td>'.$header.'</td>';
}
echo '</tr>';

// the data
foreach ($alldata as $data)
{
echo '<tr>';
foreach ($allheaders as $field)
{
// field is filled
if ($data[$field])
{
echo '<td>'.$data[$field].'</td>';
}
// empty field
else
{
echo '<td>&nbsp;</td>';
}
}
echo '</tr>';
}
echo '</table>';

--
Arjen
http://www.hondenpage.com
.



Relevant Pages

  • Re: Importing Excel Data - Recognizing Headers
    ... some VBA code that the macro would call. ... workbook somewhere on their individual network. ... to see that first row as having headers in them. ...
    (microsoft.public.access.externaldata)
  • Re: How can I import multiple .csv files into access?
    ... Access can do this but it takes a litle time and works a lot smoother if you have at least intermediate level experience. ... Use the CLI copy command to concatenate the files into one file - if the files contain headers - you can open the file with notepad, use the Ctrl-F search tool to find the headers - and delete all but the very first row of headers. ... If you are at all familiar with the old DOS days ways, and using batch files, then you know exactly what I am talking about. ...
    (microsoft.public.access.externaldata)
  • Re: Importing Excel Data - Recognizing Headers
    ... to see that first row as having headers in them. ... I have an Excel macro that creates a workbook with column headings in row ...
    (microsoft.public.access.externaldata)
  • Re: Text to Columns - delimited
    ... "First row contains headers" is in Sort, ... "megankathryn" wrote in message ... "Dave Peterson" wrote: ...
    (microsoft.public.excel.misc)