note 27391 added to function.odbc-result-all
| From: | sanjay dot ghimire at kpmg-infodesign dot com | Date: | Wed, 04 Dec 2002 09:47:45 +0000 |
| Subject: | note 27391 added to function.odbc-result-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40328@lists.php.net to get a copy of this message | ||
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;
}
--
http://www.php.net/manual/en/function.odbc-result-all.php
http://master.php.net/manage/user-notes.php?action=edit+27391
http://master.php.net/manage/user-notes.php?action=delete+27391
http://master.php.net/manage/user-notes.php?action=reject+27391