Dynamic HTML Table Generation with PHP

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
ronin1770
Forum Newbie
Posts: 3
Joined: Fri Feb 15, 2008 11:32 pm

Dynamic HTML Table Generation with PHP

Post by ronin1770 »

HI,

I am trying to create a PHP data grid - which accesses the database - retrieves data fields and data and prints out as a grid.

here the syntax in
<table>
<header row>Header</header row>

<data row colspan='num of fields'>
<div>
<inner table with data>
</div>
</data row>
</table>

The reason for having a DIV is to later use AJAX for inline editing of the row - the problem(s)

- column width of outer table - can't use absolute values since data size varies
- even if I calculate the length of data for a specific field and then set the width - it doesn't respect it
- some of the database tables are many fields (as many as 71)
- tables are declared as <table width='100%' cellpadding=0 cellspacing=0>


what am i missing here ?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Dynamic HTML Table Generation with PHP

Post by Christopher »

What is your question? It seems to be something about widths.
(#10850)
ronin1770
Forum Newbie
Posts: 3
Joined: Fri Feb 15, 2008 11:32 pm

Re: Dynamic HTML Table Generation with PHP

Post by ronin1770 »

precisely - the problem with width in the inner table

i want them to be same as the header created in the outer table

attaching the screen shot below:
Attachments
forum_pic.JPG
forum_pic.JPG (51.02 KiB) Viewed 875 times
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Dynamic HTML Table Generation with PHP

Post by califdon »

There are just dozens and dozens of php data grid scripts available (try hotscripts.com, for example) and they use many different approaches to display the results. You would do well to download several of these and examine their code.
Attilitus
Forum Commoner
Posts: 27
Joined: Wed Aug 08, 2007 2:32 pm

Re: Dynamic HTML Table Generation with PHP

Post by Attilitus »

This is ridiculously simple...

Code: Select all

<table>
<tr>
<td>c1</td><td>c2</td><td>c3</td>
</tr>
 
while(){
<tr>
<td>c1data</td><td>c2data</td><td>c3data</td>
</tr>
}
</table>
If you do it like that, the columns WILL align.
ronin1770
Forum Newbie
Posts: 3
Joined: Fri Feb 15, 2008 11:32 pm

Re: Dynamic HTML Table Generation with PHP

Post by ronin1770 »

Attilitus wrote:This is ridiculously simple...

Code: Select all

<table>
<tr>
<td>c1</td><td>c2</td><td>c3</td>
</tr>
 
while(){
<tr>
<td>c1data</td><td>c2data</td><td>c3data</td>
</tr>
}
</table>
If you do it like that, the columns WILL align.
well - i now that - but data row is in different table -
Post Reply