rogerzebra
03-31-2005, 12:06 AM
Hi guys,
I'm stuck with a layout problem. I really can't figure this out, so all help would be appreciated. I fetching data from a while loop into rows and cells and wondering if it's possible to split up the result? I want textfield in between certain retrieved data. What I need is to know how to fetch parts of the data. Something like split the $result string in arrays and view the result arrays within tables and cells. Now I retrieve the hole chunk of data and can't sqeeze in textfields between the loop result. I need it to be in a nice layout for print.
I appreciate all effort.
/rz
$total_rows = mysql_num_rows($result);
if (!$total_rows) {
print "<HTML><BODY><h1>Table $submissions is empty</h1></BODY></HTML>";
return;
}
$row = mysql_fetch_row($result);
$total_cols = count($row);
print "<HTML><BODY>";
print "<table width='100%' border='1' cellspacing='0' cellpadding='0' align='center' bgcolor='CFB9B9'>";
print "<tr><td colspan=$total_cols align=center><strong><font size='2'><font color='F2F2F2'><br>$name Table (rows: $total_rows, column: $total_cols)</font></font></strong></td></tr>";
echo "<table border=.5>\n";
echo "<tr><td><b>Producer Code</b></td><td><b>Producer</b></td><td><b>Address</b></td><td><b>Phone Number</b></td><td><b>Fax Number</b></td><td><b>Zip Code</b></td><td><b>Contacts 1</b></td><td><b>Contacts 2</b></td><td><b>Email Address</b></td><td><b>www Address</b></td><td><b>Fein</b></td></tr>\n";
print "<tr>";
$i=0;
// Loop
while($i < $total_cols)
{
print "<td>";
print $row[$i];
print "</td>";
$i++;
}
print "</tr>";
while($row = mysql_fetch_row ($result))
{
$i = 0;
print "<tr>";
while($i < $total_cols){
print "<td>";
print $row[$i];
print "</td>";
$i++;
}
print "</tr>";
}
print "</TABLE></BODY></HTML>";
I'm stuck with a layout problem. I really can't figure this out, so all help would be appreciated. I fetching data from a while loop into rows and cells and wondering if it's possible to split up the result? I want textfield in between certain retrieved data. What I need is to know how to fetch parts of the data. Something like split the $result string in arrays and view the result arrays within tables and cells. Now I retrieve the hole chunk of data and can't sqeeze in textfields between the loop result. I need it to be in a nice layout for print.
I appreciate all effort.
/rz
$total_rows = mysql_num_rows($result);
if (!$total_rows) {
print "<HTML><BODY><h1>Table $submissions is empty</h1></BODY></HTML>";
return;
}
$row = mysql_fetch_row($result);
$total_cols = count($row);
print "<HTML><BODY>";
print "<table width='100%' border='1' cellspacing='0' cellpadding='0' align='center' bgcolor='CFB9B9'>";
print "<tr><td colspan=$total_cols align=center><strong><font size='2'><font color='F2F2F2'><br>$name Table (rows: $total_rows, column: $total_cols)</font></font></strong></td></tr>";
echo "<table border=.5>\n";
echo "<tr><td><b>Producer Code</b></td><td><b>Producer</b></td><td><b>Address</b></td><td><b>Phone Number</b></td><td><b>Fax Number</b></td><td><b>Zip Code</b></td><td><b>Contacts 1</b></td><td><b>Contacts 2</b></td><td><b>Email Address</b></td><td><b>www Address</b></td><td><b>Fein</b></td></tr>\n";
print "<tr>";
$i=0;
// Loop
while($i < $total_cols)
{
print "<td>";
print $row[$i];
print "</td>";
$i++;
}
print "</tr>";
while($row = mysql_fetch_row ($result))
{
$i = 0;
print "<tr>";
while($i < $total_cols){
print "<td>";
print $row[$i];
print "</td>";
$i++;
}
print "</tr>";
}
print "</TABLE></BODY></HTML>";