本文整理汇总了PHP中rs2html函数的典型用法代码示例。如果您正苦于以下问题:PHP rs2html函数的具体用法?PHP rs2html怎么用?PHP rs2html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rs2html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testsql
function testsql()
{
//define('ADODB_FORCE_NULLS',1);
include '../adodb.inc.php';
include '../tohtml.inc.php';
//==========================
// This code tests an insert
$sql = "\r\r\nSELECT * \r\r\nFROM ADOXYZ WHERE id = -1";
// Select an empty record from the database
$conn =& ADONewConnection("mysql");
// create a connection
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$conn->debug = 1;
$conn->PConnect("localhost", "root", "", "test");
// connect to MySQL, testdb
$conn->Execute("delete from adoxyz where lastname like 'Smith%'");
$rs = $conn->Execute($sql);
// Execute the query and get the empty recordset
$record = array();
// Initialize an array to hold the record data to insert
// Set the values for the fields in the record
$record["firstname"] = 'null';
$record["lastname"] = "Smith\$@//";
$record["created"] = time();
//$record["id"] = -1;
// Pass the empty recordset and the array containing the data to insert
// into the GetInsertSQL function. The function will process the data and return
// a fully formatted insert sql statement.
$insertSQL = $conn->GetInsertSQL($rs, $record);
$conn->Execute($insertSQL);
// Insert the record into the database
//==========================
// This code tests an update
$sql = "\r\r\nSELECT * \r\r\nFROM ADOXYZ WHERE lastname=" . $conn->qstr($record['lastname']);
// Select a record to update
$rs = $conn->Execute($sql);
// Execute the query and get the existing record to update
if (!$rs) {
print "<p>No record found!</p>";
}
$record = array();
// Initialize an array to hold the record data to update
// Set the values for the fields in the record
$record["firstName"] = "Caroline" . rand();
$record["lasTname"] = "Smithy Jones";
// Update Caroline's lastname from Miranda to Smith
$record["creAted"] = '2002-12-' . (rand() % 30 + 1);
$record['num'] = 3921;
// Pass the single record recordset and the array containing the data to update
// into the GetUpdateSQL function. The function will process the data and return
// a fully formatted update sql statement.
// If the data has not changed, no recordset is returned
$updateSQL = $conn->GetUpdateSQL($rs, $record);
$conn->Execute($updateSQL);
// Update the record in the database
print "<p>Rows Affected=" . $conn->Affected_Rows() . "</p>";
$rs = $conn->Execute("select * from adoxyz where lastname like 'Smith%'");
adodb_pr($rs);
rs2html($rs);
}
示例2: Tables
function Tables()
{
if (!$this->tablesSQL) {
return false;
}
$rs = $this->conn->Execute($this->tablesSQL);
if (!$rs) {
return false;
}
$html = rs2html($rs, false, false, false, false);
return $html;
}
示例3: testFindByParentId
function testFindByParentId()
{
global $success, $failure;
$category = new Categories();
if (!isset($category)) {
print "Category is not set";
$failure++;
}
if (($rs = $category->findFindByParentId(0)) === false) {
$failure++;
} else {
rs2html($rs);
$success++;
}
}
示例4: Tables
function Tables($orderby = '1')
{
if (!$this->tablesSQL) {
return false;
}
$savelog = $this->conn->LogSQL(false);
$rs = $this->conn->Execute($this->tablesSQL . ' order by ' . $orderby);
$this->conn->LogSQL($savelog);
$html = rs2html($rs, false, false, false, false);
return $html;
}
示例5: CheckMemory
function CheckMemory()
{
if ($this->version['version'] < 9) {
return 'Oracle 9i or later required';
}
$rs = $this->conn->Execute("\r\nselect a.name Buffer_Pool, b.size_for_estimate as cache_mb_estimate, \r\n\tcase when b.size_factor=1 then \r\n \t\t'<<= Current'\r\n\t when a.estd_physical_read_factor-b.estd_physical_read_factor > 0.001 and b.estd_physical_read_factor<1 then\r\n\t\t'- BETTER than current by ' || round((1-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) || '%'\r\n\telse ' ' end as RATING, \r\n b.estd_physical_read_factor \"Phys. Reads Factor\",\r\n round((a.estd_physical_read_factor-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) as \"% Improve\"\r\n from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) a , \r\n (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) b \r\n where a.r = b.r-1 and a.name = b.name\r\n ");
if (!$rs) {
return false;
}
/*
The v$db_cache_advice utility show the marginal changes in physical data block reads for different sizes of db_cache_size
*/
$s = "<h3>Data Cache Advice Estimate</h3>";
if ($rs->EOF) {
$s .= "<p>Cache that is 50% of current size is still too big</p>";
} else {
$s .= "Ideal size of Data Cache is when %BETTER gets close to zero.";
$s .= rs2html($rs, false, false, false, false);
}
return $s . $this->PGA_Advice();
}
示例6: CheckMemory
function CheckMemory()
{
if ($this->version['version'] < 9) {
return 'Oracle 9i or later required';
}
$rs =& $this->conn->Execute("\r\nselect a.size_for_estimate as cache_mb_estimate,\r\n\tcase when a.size_factor=1 then \r\n \t\t'<<= current'\r\n\t when a.estd_physical_read_factor-b.estd_physical_read_factor > 0 and a.estd_physical_read_factor<1 then\r\n\t\t'- BETTER - '\r\n\telse ' ' end as currsize, \r\n a.estd_physical_read_factor-b.estd_physical_read_factor as best_when_0\r\n from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r from v\$db_cache_advice) a , \r\n (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r from v\$db_cache_advice) b where a.r = b.r-1");
if (!$rs) {
return false;
}
/*
The v$db_cache_advice utility show the marginal changes in physical data block reads for different sizes of db_cache_size
*/
$s = "<h3>Data Cache Estimate</h3>";
if ($rs->EOF) {
$s .= "<p>Cache that is 50% of current size is still too big</p>";
} else {
$s .= "Ideal size of Data Cache is when \"best_when_0\" changes from a positive number and becomes zero.";
$s .= rs2html($rs, false, false, false, false);
}
return $s;
}
示例7: Tables
function Tables()
{
$rs = $this->conn->Execute("select tabschema,tabname,card as rows,\n\t\t\tnpages pages_used,fpages pages_allocated, tbspace tablespace \n\t\t\tfrom syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2");
return rs2html($rs, false, false, false, false);
}
示例8: testsql
//.........这里部分代码省略.........
// create a connection
$conn->PConnect("localhost", "root", "", "test");
// connect to MySQL, testdb
#$conn =& ADONewConnection('oci8po');
#$conn->Connect('','scott','natsoft');
if (PHP_VERSION >= 5) {
$connstr = "mysql:dbname=northwind";
$u = 'root';
$p = '';
$conn =& ADONewConnection('pdo');
$conn->Connect($connstr, $u, $p);
}
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$conn->debug = 1;
$conn->Execute("delete from adoxyz where lastname like 'Smi%'");
$rs = $conn->Execute($sql);
// Execute the query and get the empty recordset
$record = array();
// Initialize an array to hold the record data to insert
if (strpos($conn->databaseType, 'mysql') === false) {
$record['id'] = 751;
}
$record["firstname"] = 'Jann';
$record["lastname"] = "Smitts";
$record["created"] = time();
$insertSQL = $conn->GetInsertSQL($rs, $record);
$conn->Execute($insertSQL);
// Insert the record into the database
if (strpos($conn->databaseType, 'mysql') === false) {
$record['id'] = 752;
}
// Set the values for the fields in the record
$record["firstname"] = 'anull';
$record["lastname"] = "Smith\$@//";
$record["created"] = time();
if (isset($_GET['f'])) {
$ADODB_FORCE_TYPE = $_GET['f'];
}
//$record["id"] = -1;
// Pass the empty recordset and the array containing the data to insert
// into the GetInsertSQL function. The function will process the data and return
// a fully formatted insert sql statement.
$insertSQL = $conn->GetInsertSQL($rs, $record);
$conn->Execute($insertSQL);
// Insert the record into the database
$insertSQL2 = $conn->GetInsertSQL($table = 'ADOXYZ', $record);
if ($insertSQL != $insertSQL2) {
echo "<p><b>Walt's new stuff failed</b>: {$insertSQL2}</p>";
}
//==========================
// This code tests an update
$sql = "\nSELECT * \nFROM ADOXYZ WHERE lastname=" . $conn->Param('var') . " ORDER BY 1";
// Select a record to update
$varr = array('var' => $record['lastname'] . '');
$rs = $conn->Execute($sql, $varr);
// Execute the query and get the existing record to update
if (!$rs || $rs->EOF) {
print "<p><b>No record found!</b></p>";
}
$record = array();
// Initialize an array to hold the record data to update
// Set the values for the fields in the record
$record["firstName"] = "Caroline" . rand();
//$record["lasTname"] = ""; // Update Caroline's lastname from Miranda to Smith
$record["creAted"] = '2002-12-' . (rand() % 30 + 1);
$record['num'] = '';
// Pass the single record recordset and the array containing the data to update
// into the GetUpdateSQL function. The function will process the data and return
// a fully formatted update sql statement.
// If the data has not changed, no recordset is returned
$updateSQL = $conn->GetUpdateSQL($rs, $record);
$conn->Execute($updateSQL, $varr);
// Update the record in the database
if ($conn->Affected_Rows() != 1) {
print "<p><b>Error1 </b>: Rows Affected=" . $conn->Affected_Rows() . ", should be 1</p>";
}
$record["firstName"] = "Caroline" . rand();
$record["lasTname"] = "Smithy Jones";
// Update Caroline's lastname from Miranda to Smith
$record["creAted"] = '2002-12-' . (rand() % 30 + 1);
$record['num'] = 331;
$updateSQL = $conn->GetUpdateSQL($rs, $record);
$conn->Execute($updateSQL, $varr);
// Update the record in the database
if ($conn->Affected_Rows() != 1) {
print "<p><b>Error 2</b>: Rows Affected=" . $conn->Affected_Rows() . ", should be 1</p>";
}
$rs = $conn->Execute("select * from ADOXYZ where lastname like 'Sm%'");
//adodb_pr($rs);
rs2html($rs);
$record["firstName"] = "Carol-new-" . rand();
$record["lasTname"] = "Smithy";
// Update Caroline's lastname from Miranda to Smith
$record["creAted"] = '2002-12-' . (rand() % 30 + 1);
$record['num'] = 331;
$conn->AutoExecute('ADOXYZ', $record, 'UPDATE', "lastname like 'Sm%'");
$rs = $conn->Execute("select * from ADOXYZ where lastname like 'Sm%'");
//adodb_pr($rs);
rs2html($rs);
}
示例9: testdb
//.........这里部分代码省略.........
case 'mssql':
/*
ASSUME Northwind available...
CREATE PROCEDURE SalesByCategory
@CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998'
AS
IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998'
BEGIN
SELECT @OrdYear = '1998'
END
SELECT ProductName,
TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0)
FROM [Order Details] OD, Orders O, Products P, Categories C
WHERE OD.OrderID = O.OrderID
AND OD.ProductID = P.ProductID
AND P.CategoryID = C.CategoryID
AND C.CategoryName = @CategoryName
AND SUBSTRING(CONVERT(nvarchar(22), O.OrderDate, 111), 1, 4) = @OrdYear
GROUP BY ProductName
ORDER BY ProductName
GO
*/
print "<h4>Testing Stored Procedures for mssql</h4>";
$saved = $db->debug;
$db->debug = true;
$cat = 'Dairy Products';
$yr = '1998';
$stmt = $db->PrepareSP('SalesByCategory');
$db->Parameter($stmt, $cat, 'CategoryName');
$db->Parameter($stmt, $yr, 'OrdYear');
$rs = $db->Execute($stmt);
rs2html($rs);
$cat = 'Grains/Cereals';
$yr = 1998;
$stmt = $db->PrepareSP('SalesByCategory');
$db->Parameter($stmt, $cat, 'CategoryName');
$db->Parameter($stmt, $yr, 'OrdYear');
$rs = $db->Execute($stmt);
rs2html($rs);
/*
Test out params - works in 4.2.3 but not 4.3.0???:
CREATE PROCEDURE at_date_interval
@days INTEGER,
@start VARCHAR(20) OUT,
@end VARCHAR(20) OUT
AS
BEGIN
set @start = CONVERT(VARCHAR(20), getdate(), 101)
set @end =CONVERT(VARCHAR(20), dateadd(day, @days, getdate()), 101 )
END
GO
*/
$stmt = $db->PrepareSP('at_date_interval');
$days = 10;
$begin_date = '';
$end_date = '';
$db->Parameter($stmt, $days, 'days', false, 4, SQLINT4);
$db->Parameter($stmt, $begin_date, 'start', 1, 20, SQLVARCHAR);
$db->Parameter($stmt, $end_date, 'end', 1, 20, SQLVARCHAR);
$db->Execute($stmt);
if (empty($begin_date) or empty($end_date)) {
Err("MSSQL SP Test for OUT Failed");
print "begin={$begin_date} end={$end_date}<p>";
示例10: rs2html
case 'cau':
case 'mdv':
case 'tma':
case 'ctt':
case 'bge':
case 'sts':
case 'dpc':
case 'eap':
case 'mime':
case 'ate':
case 'msa':
case 'mtd':
case 'detcau':
case 'motanu':
case 'motmodif':
$html = rs2html($Rs_clta, 'border=1 cellpadding=0 align=center', $tit_columnas, true, false);
$pos1 = strpos($html, "</TABLE>\n\n");
$cnt_tmp = substr_count($html, "</TH>\n</tr>");
if ($cnt_tmp > 1) {
while (--$cnt_tmp) {
$pos1 = strpos($html, "</TABLE>\n\n");
$pos2 = strpos($html, "</TH>\n</tr>", $pos1) + 11;
$html = substr($html, 0, $pos1) . substr($html, $pos2, strlen($html));
}
}
echo $html;
break;
default:
include $ADODB_PATH . '/adodb-pager.inc.php';
$pager = new ADODB_Pager($conn, $isql);
$pager->Render($rows_per_page = 20);
示例11: rs2html
<link href="<?php
echo $BASE_URL;
?>
public/styles/style.css" rel="stylesheet" type="text/css">
<link href="<?php
echo $BASE_URL;
?>
public/styles/print.css" rel="stylesheet" type="text/css" media="print" />
</head>
<body marginwidth="20" marginheight="20">
<div style="width: 760px;" align="center">
<?php
echo $header->get_empresa($PATH_IMAGES);
?>
<h2>CURSOS COM ALUNOS MATRICULADOS NO PERÍODO</h2>
<?php
echo $info;
rs2html($RsCursos, 'cellspacing="0" border="0" class="tabela_relatorio" cellpadding="0"');
?>
</div>
<br />
<div class="nao_imprime">
<input type="button" value="Imprimir" onClick="window.print()" />
<a href="#" onclick="javascript:window.close();">Fechar</a>
</div>
<br />
</body>
</html>
示例12: switch
echo $titulo;
?>
</title></head>
<body>
<?php
switch ($_GET['var']) {
case 'tar':
case 'pai':
case 'ctt':
case 'dpt':
case 'dpc':
case 'cau':
case 'mdv':
case 'tpr':
case 'sts':
case 'lcd':
case 'fnv':
case 'tma':
case 'bge':
rs2html($Rs_clta, 'border=1 cellpadding=0', $tit_columnas);
break;
default:
include $ADODB_PATH . '/adodb-pager.inc.php';
$pager = new ADODB_Pager($conn, $isql);
$pager->Render($rows_per_page = 20);
break;
}
$Rs_clta->Close();
?>
</body>
</html>
示例13: RenderGrid
function RenderGrid()
{
global $gSQLBlockRows;
// used by rs2html to indicate how many rows to display
$rutaRaiz = $this->rutaRaiz;
include_once ADODB_DIR . '/tohtml.inc.php';
ob_start();
$gSQLBlockRows = $this->rows;
if ($this->smarty_render) {
$htmlContent['data'] = rs2array($this->db, $this->rs, $this->gridAttributes, $this->gridHeader, $this->htmlSpecialChars, true, $this->toRefVars, $this->orderTipo, $this->ordenActual, $this->rutaRaiz, $this->checkAll, $this->checkTitulo, $this->descCarpetasGen, $this->descCarpetasPer, $this->colOptions, $this->pagEdicion, $this->pagConsulta);
return $htmlContent;
} else {
$htmlContent = rs2html($this->db, $this->rs, $this->gridAttributes, $this->gridHeader, $this->htmlSpecialChars, true, $this->toRefVars, $this->orderTipo, $this->ordenActual, $this->rutaRaiz, $this->checkAll, $this->checkTitulo, $this->descCarpetasGen, $this->descCarpetasPer, $this->colOptions, $this->pagEdicion, $this->pagConsulta);
$xsql = serialize($this->sql);
$_SESSION['xsql'] = $xsql;
$_SESSION['rutaRaiz'] = $rutaRaiz;
echo "<a style='border:0px' href='{$rutaRaiz}/adodb/adodb-doc.inc.php' target='_blank'>\r\n <img src='{$rutaRaiz}/adodb/compfile.png' width='40' heigth='40' border='0' ></a>";
echo "<a href='{$rutaRaiz}/adodb/adodb-xls.inc.php' target='_blank'>\r\n <img src='{$rutaRaiz}/adodb/spreadsheet.png' width='40' heigth='40' border='0'></a>";
$s = ob_get_contents();
ob_end_clean();
return $s;
}
}
示例14: testdb
//.........这里部分代码省略.........
$db->Execute('update ADOXYZ set id=id+1');
$nrows = $db->Affected_Rows();
if ($nrows === false) {
print "<p><b>Affected_Rows() not supported</b></p>";
} else {
if ($nrows != 50) {
print "<p><b>Affected_Rows() Error: {$nrows} returned (should be 50) </b></p>";
} else {
print "<p>Affected_Rows() passed</p>";
}
}
$db->debug = false;
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
///////////////////////////////
$rs =& $db->Execute("select * from ADOXYZ order by id");
if ($rs) {
print_r($rs->fields);
if ($rs->RecordCount() != 50) {
print "<p><b>RecordCount returns -1</b></p>";
if ($rs->PO_RecordCount('ADOXYZ') == 50) {
print "<p> PO_RecordCount passed</p>";
} else {
print "<p><b>PO_RecordCount returns wrong value</b></p>";
}
} else {
print "<p>RecordCount() passed</p>";
}
if (isset($rs->fields['firstname'])) {
print '<p>The fields columns can be indexed by column name.</p>';
} else {
print '<p>The fields columns <i>cannot</i> be indexed by column name.</p>';
}
if (empty($HTTP_GET_VARS['hide'])) {
rs2html($rs);
}
} else {
print "<b>Error in Execute of SELECT</b></p>";
}
$val = $db->GetOne("select count(*) from ADOXYZ");
if ($val == 50) {
print "<p>GetOne returns ok</p>";
} else {
print "<p><b>Fail: GetOne returns {$val}</b></p>";
}
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$val = $db->GetRow("select count(*) from ADOXYZ");
if ($val[0] == 50 and sizeof($val) == 1) {
print "<p>GetRow returns ok</p>";
} else {
print_r($val);
print "<p><b>Fail: GetRow returns {$val[0]}</b></p>";
}
print "<p>FetchObject/FetchNextObject Test</p>";
$rs =& $db->Execute('select * from ADOXYZ');
if (empty($rs->connection)) {
print "<b>Connection object missing from recordset</b></br>";
}
while ($o = $rs->FetchNextObject()) {
// calls FetchObject internally
if (!is_string($o->FIRSTNAME) || !is_string($o->LASTNAME)) {
print_r($o);
print "<p><b>Firstname is not string</b></p>";
break;
}
}
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
示例15: DoSQLForm
function DoSQLForm()
{
$PHP_SELF = $_SERVER['PHP_SELF'];
$sql = isset($_REQUEST['sql']) ? $_REQUEST['sql'] : '';
// Let the form spoofing commence... ***
if (isset($_SESSION['phplens_sqlrows'])) {
$rows = $_SESSION['phplens_sqlrows'];
} else {
$rows = 3;
}
if (isset($_REQUEST['SMALLER'])) {
$rows /= 2;
if ($rows < 3) {
$rows = 3;
}
$_SESSION['phplens_sqlrows'] = $rows;
}
if (isset($_REQUEST['BIGGER'])) {
$rows *= 2;
$_SESSION['phplens_sqlrows'] = $rows;
}
?>
<form method="post" action="<?php
echo $_SERVER['PHP_SELF'];
?>
">
<table><tr>
<td> Form size: <input type="submit" value=" < " name="SMALLER" /><input type="submit" value=" > > " name="BIGGER" />
</td>
<td align=right>
<input type="submit" value=" Run SQL Below " name="RUN" /><input type="hidden" name="do" value="dosql" />
</td></tr>
<tr>
<td colspan="2"><textarea rows="<?php
print $rows;
?>
" name="sql" cols="80"><?php
print htmlentities($sql, ENT_QUOTES, 'UTF-8');
?>
</textarea>
</td>
</tr>
</table>
</form>
<?php
if (!isset($_REQUEST['sql'])) {
return;
}
$sql = $this->undomq(trim($sql));
if (substr($sql, strlen($sql) - 1) === ';') {
$print = true;
$sqla = $this->SplitSQL($sql);
} else {
$print = false;
$sqla = array($sql);
}
foreach ($sqla as $sqls) {
if (!$sqls) {
continue;
}
if ($print) {
print "<p>" . htmlentities($sqls, ENT_QUOTES, 'UTF-8') . "</p>";
flush();
}
$savelog = $this->LogSQL(false);
$rs = $this->Execute($sqls);
$this->LogSQL($savelog);
if ($rs && is_object($rs) && !$rs->EOF) {
rs2html($rs);
while ($rs->NextRecordSet()) {
print "<table style=\"width: 98%; background-color: #C0C0FF;\"><tr><td> </td></tr></table>";
rs2html($rs);
}
} else {
$e1 = (int) $this->ErrorNo();
$e2 = $this->ErrorMsg();
if ($e1 || $e2) {
if (empty($e1)) {
$e1 = '-1';
}
// postgresql fix
print ' ' . $e1 . ': ' . $e2;
} else {
print "<p>No Recordset returned<br /></p>";
}
}
}
// foreach
}