FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » table appears with empty rows, and row data appears before table. Code seems ok. What is going on?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: table appears with empty rows, and row data appears before table. Code seems ok. What is going on? [message #178163 is a reply to message #178162] Wed, 16 May 2012 14:59 Go to previous messageGo to previous message
Paul Herber is currently offline  Paul Herber
Messages: 26
Registered: February 2011
Karma:
Junior Member
On Wed, 16 May 2012 07:37:22 -0700 (PDT), "kurtk(at)pobox(dot)com" <kurtk(at)pobox(dot)com> wrote:

> I have code which displays a HTML <table>. The data in the rows comes is read from a file. But the row data is appearing (minus the <tr></tr> tags) on the web page before the table. The table displays with empty rows below what was supposed to be the row data.
>
> In other words this php...
>
> echo "<table>\n<thead>\n<tr><th>number</th><th>date</th><th>First Name</th><th>Last Name</th><th>state</th><th>country</th><th>remarks</th></tr>\n</thead >\n<tbody>\n";
>
> try {
>
> $fileh = fopen("data/petition-051512.csv", "r");
>
> while ($text = fgets($fileh)) {
>
> $tok = strtok($text, ",");
>
> while ($tok !== FALSE) {
>
> echo "<tr>" . $tok . "</tr>\n";
>
> $tok = strtok(",");
> }
> }
> echo "</tbody></table>\n";
> return;
>
> produces html that looks like one big mass of text, consisting of the 560 rows of data, minus any table tags, followed by a table with 560 empty rows.
>
> I can't figure this out.

You need <td> ... </td>
around your data.



--
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Solution Manuals & Test Banks Updated 2012
Next Topic: update mysql without manually tying SET statements
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 18:27:56 GMT 2024

Total time taken to generate the page: 0.04232 seconds