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

Home » Imported messages » comp.lang.php » looking for ideas on how turn a php created html table with 10 rows into a 2 row table with extra columns appended to the end
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: looking for ideas on how turn a php created html table with 10 rows into a 2 row table with extra columns appended to the end [message #174220 is a reply to message #174219] Fri, 27 May 2011 13:13 Go to previous messageGo to previous message
styliek is currently offline  styliek
Messages: 3
Registered: May 2011
Karma:
Junior Member
Hi,

At the moment the .php is pulling data from the database, running a
few sql's making sure its the data I want and then performs the below
code to pass data to a html file which then proceeds to create the
table. I have omitted some code If I omitted too much please let me
know.

My problem is that while the html table populates correctly with
mulitple rows where Col A is only ever 2 things, I would rather have
Col A containing unique data(table just has 2 rows) and have multiple
columns instead corresponding to it (Col A row 1 Col A row 2)... ??

..php

if (in_array($MetricTypeID,
array(1046,1051,1052,1054,1063,1074,1075,1103,1104))) {
array_push($DataTables['Sec'], sprintf("\t\t['/
metrics/PerformanceDetails.php?DeviceID=%s;MetricID=%s', '%s', '%s',
'%s', '%s']",
$DeviceID,
$MetricID,
$Instance,
$MetricType,
sprintf("%3.3f",
$Metrics[$MetricTypeID][$MetricID]['Average']),
sprintf("%3.3f",
$Metrics[$MetricTypeID][$MetricID]['Peak'])
));


..html

var TABLE_LAYOUT_SEC = [
{
'name' : 'DataSetID',
'type' : NUM,
'hide' : true
},
{
'name' : 'Instance',
'type' : STR
},
{
'name' : 'Metric Type',
'type' : STR
},
{
'name' : 'Avg Value',
'type' : NUM
},
{
'name' : 'Peak Value',
'type' : NUM
}
];

var TABLE_LOOK_SEC = {
'onclick' : function (ThisRow, ThisRowValues, AllMarkedKeys) {
var URL = ThisRowValues[0];
location.href = URL;
},
// Indicates if multiple row selection mode for a table is on
'multy_mark' : false,
// 0 - caption,
// 1 - header rows to be skipped at the top when applying
effects,
// 2 - body,
// 3 - footer rows to be skipped at the bottom when applying
effects,
// 4 - paging,
// 5 - filters
'structure' : [0, 2],
'params' : [3, 0], // [cellpadding,cellspacing]
'colors' : {
'even' : 'white',
'odd' : '#DBEAF5',
'hovered' : '#FFCCAA',
'marked' : '#FFCC66'
},
'freeze' : [0, 0], // how many rows to skip [at_the_top,
at_the_bottom] when applying effects
'paging' : {
'by' : 0, // page size (0 - no paging)
'tt' : ' Page %ind of %pgs '
},
'sorting' : {
// HTML for ascending sorted state icon
'as' : '<img src="../../images/
TableSortAscendingBlue.gif" border="0" height="4" width="8" alt="sort
descending">',
// HTML for descending sorted state icon
'ds' : '<img src="../../images/
TableSortDescendingBlue.gif" border="0" height="4" width="8" alt="sort
ascending">',
// HTML for unsorted state icon
'no' : '<img src="../../images/TableSortNoneBlue.gif"
border="0" height="9" width="8" alt="sort ascending">',
'cl' : null,
// Order of sorted: true - ascending sorted, false
descending sorted
'or' : false
},
'filter' :{
'type':0
},
'css' : {
'main' : 'tabTable',
'body' :
['','tabBodyColDesc','tabBodyColDesc','tabBodyColText','tabBodyColText','ta bBodyColPerc','tabBodyColPerc'],
'captCell' : 'tabCaptionCell',
'captText' : 'tabCaptionLink',
'head' : 'tabHeadCell',
'foot' : 'tabFootCell',
'pagnCell' : 'tabPaging',
'pagnText' : 'tabPagingText',
'pagnPict' : 'tabPagingArrowCell',
'filtCell' : 'tabFilter',
'filtPatt' : 'tabFilterPattern',
'filtSelc' : 'tabFilterSelect'
}
};








{if (array_key_exists('SEC', $TableItems))}

<table border="0" cellspacing="0" cellpadding="0" class="FieldSet">

<tr>

<td height="4" width="7" class="TopLeft"><img src="../../images/
1Pixel.gif" height="4" width="7" /></td>

<td height="4" width="100%" class="TopCenter"></td>

<td height="4" width="7" class="TopRight"><img src="../../images/
1Pixel.gif" height="4" width="7" /></td>

</tr>

<tr>

<td width="7" class="MiddleLeft"></td>

<td class="MiddleCenter" height="100%" style="vertical-align: top">

<span class="FieldSetContentTitle">SLA Time Metrics Collected</span>

<br>

<img src="../../images/FieldSetHorizontalSeparatorLeft.png"
alt="Horizontal Separator">

<p>

<table align=left bgcolor="#336699" cellpadding="0" cellspacing="0"
valign="top" align="center" style="background: #336699 url(../../
images/1PixelGray.png) top right no-repeat">

<tr>

<td style="background: url(../../images/1PixelGray.png) top left no-
repeat">

<table width=100% cellpadding="1" cellspacing="0" valign="top"
align="center">

<tr>

<td>

<script type="text/javascript">

new TTable(TABLE_LAYOUT_SEC, TABLE_CONTENT_SEC, TABLE_LOOK_SEC);

</script>

</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

<td width="7" class="MiddleRight"></td>

</tr>

<tr>

<td height="4" width="7" class="BottomLeft"></td>

<td height="4" class="BottomCenter"></td>

<td height="4" width="7" class="BottomRight"></td>

</tr>

</table>

Thanks for any advice/opinions
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: addsworld
Next Topic: mysqli_stmt::store_result?
Goto Forum:
  

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

Current Time: Thu Nov 28 20:10:54 GMT 2024

Total time taken to generate the page: 0.04519 seconds