$gSQLBlockRows. This is because * web browsers normally require the whole table to be downloaded * before it can be rendered, so we break the output into several * smaller, faster rendering tables. * * This file is part of ADOdb, a Database Abstraction Layer library for PHP. * * @package ADOdb * @link https://adodb.org Project's web site and documentation * @link https://github.com/ADOdb/ADOdb Source code and issue tracker * * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, * any later version. This means you can use it in proprietary products. * See the LICENSE.md file distributed with this source code for details. * @license BSD-3-Clause * @license LGPL-2.1-or-later * * @copyright 2000-2013 John Lim * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community */ // specific code for tohtml GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND; $ADODB_ROUND=4; // rounding $gSQLMaxRows = 1000; // max no of rows to download $gSQLBlockRows=20; // max no of rows per table block // $rs: the recordset // $ztabhtml: the table tag attributes (optional) // $zheaderarray: contains the replacement strings for the headers (optional) // // USAGE: // include('adodb.inc.php'); // $db = ADONewConnection('mysql'); // $db->Connect('mysql','userid','password','database'); // $rs = $db->Execute('select col1,col2,col3 from table'); // rs2html($rs, 'BORDER=2', array('Title1', 'Title2', 'Title3')); // $rs->Close(); // // RETURNS: number of rows displayed function rs2html(&$rs,$ztabhtml=false,$zheaderarray=false,$htmlspecialchars=true,$echo = true) { $s ='';$rows=0;$docnt = false; GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND; if (!$rs) { printf(ADODB_BAD_RS,'rs2html'); return false; } if (! $ztabhtml) $ztabhtml = "BORDER='1' WIDTH='98%'"; //else $docnt = true; $typearr = array(); $ncols = $rs->FieldCount(); $hdr = "
$fname | "; } $hdr .= "\n|||||||
---|---|---|---|---|---|---|---|
\n"; } else { $s .= " | ".$rs->UserDate($v,"D d, M Y") ." | \n"; } break; } case 'T': if (empty($v)) $s .= "\n"; else $s .= " | ".$rs->UserTimeStamp($v,"D d, M Y, H:i:s") ." | \n"; break; case 'N': if (abs(abs($v) - round($v,0)) < 0.00000001) $v = round($v); else $v = round($v,$ADODB_ROUND); case 'I': $vv = stripslashes((trim($v))); if (strlen($vv) == 0) $vv .= ' '; $s .= "".$vv ." | \n"; break; /* case 'B': if (substr($v,8,2)=="BM" ) $v = substr($v,8); $mtime = substr(str_replace(' ','_',microtime()),2); $tmpname = "tmp/".uniqid($mtime).getmypid(); $fd = @fopen($tmpname,'a'); @ftruncate($fd,0); @fwrite($fd,$v); @fclose($fd); if (!function_exists ("mime_content_type")) { function mime_content_type ($file) { return exec("file -bi ".escapeshellarg($file)); } } $t = mime_content_type($tmpname); $s .= (substr($t,0,5)=="image") ? "\\n" : " | $t | \\n"; break; */ default: if ($v) { $v = htmlspecialchars(stripslashes(trim($v))); } elseif ($v === null) { $v = '(NULL)'; } else { $v = ' '; } $s .= "" . str_replace("\n", ' ', $v) . " | \n";
}
} // for
$s .= "
\n"; $s .= "\n |