note 27391 deleted from function.odbc-result-all by cmb
| From: | cmb@php.net | Date: | Tue, 06 Oct 2020 11:51:36 +0000 |
| Subject: | note 27391 deleted from function.odbc-result-all by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215536@lists.php.net to get a copy of this message | ||
Note Submitter: sanjay dot ghimire at kpmg-infodesign dot com
----
I wrote a small function slightly similiar to odbc_record_all, but there you can use format for both
table and rows separately, which is not by odbc_record_all. hope it will be useful some how.
--- Sanjay, Germany
Here is code:
odbc_result_all_ex($result, 'Border=0 cellspacing=0 cellpadding=5',
"style='FONT-FAMILY:Tahoma; FONT-SIZE:8pt; BORDER-BOTTOM:solid 1pt gree'");
function odbc_result_all_ex($res, $sTable, $sRow)
{
$cFields = odbc_num_fields($res);
$strTable = "<table $sTable>";
$strTable .= "<tr>";
for ($n=1; $n<=$cFields; $n++)
{
$strTable .= "<td $sRow><b>". str_replace("_", " ",
odbc_field_name($res, $n)) . "</b></td>";
}
$strTable .= "</tr>";
while(odbc_fetch_row($res))
{
$strTable .= "<tr>";
for ($n=1; $n<=$cFields; $n++)
{
if (odbc_result($res, $n)=='')
{
$strTable .= "<td $sRow> </td>";
}
else
{
$strTable .= "<td $sRow>". odbc_result($res, $n) . "</td>";
}
}
$strTable .= "</tr>";
}
$strTable .= "</table>";
Print $strTable;
}