本文整理汇总了PHP中pg_numfields函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_numfields函数的具体用法?PHP pg_numfields怎么用?PHP pg_numfields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg_numfields函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: justdump
function justdump($tablename)
{
$res2 = pg_query("SELECT * FROM {$tablename} ");
$num2 = pg_numrows($res2);
$num2f = pg_numfields($res2);
for ($j = 0; $j < $num2; $j++) {
$insvals = "";
for ($z = 0; $z < $num2f; $z++) {
$insvals .= "'" . pg_result($res2, $j, $z) . "',";
}
$insvals = substr($insvals, 0, -1);
$sql = "INSERT INTO {$tablename} VALUES ({$insvals});";
echo $sql . "\n";
}
}
开发者ID:vrodic,项目名称:Vlakic,代码行数:15,代码来源:tosqlite.php
示例2: sqlCallback
/**
* This is a callback function to display the result of each separate query
* @param ADORecordSet $rs The recordset returned by the script execetor
*/
function sqlCallback($query, $rs, $lineno)
{
global $data, $misc, $lang, $_connection;
// Check if $rs is false, if so then there was a fatal error
if ($rs === false) {
echo htmlspecialchars($_FILES['script']['name']), ':', $lineno, ': ', nl2br(htmlspecialchars($_connection->getLastError())), "<br/>\n";
} else {
// Print query results
switch (pg_result_status($rs)) {
case PGSQL_TUPLES_OK:
// If rows returned, then display the results
$num_fields = pg_numfields($rs);
echo "<p><table>\n<tr>";
for ($k = 0; $k < $num_fields; $k++) {
echo "<th class=\"data\">", $misc->printVal(pg_fieldname($rs, $k)), "</th>";
}
$i = 0;
$row = pg_fetch_row($rs);
while ($row !== false) {
$id = $i % 2 == 0 ? '1' : '2';
echo "<tr class=\"data{$id}\">\n";
foreach ($row as $k => $v) {
echo "<td style=\"white-space:nowrap;\">", $misc->printVal($v, pg_fieldtype($rs, $k), array('null' => true)), "</td>";
}
echo "</tr>\n";
$row = pg_fetch_row($rs);
$i++;
}
echo "</table><br/>\n";
echo $i, " {$lang['strrows']}</p>\n";
break;
case PGSQL_COMMAND_OK:
// If we have the command completion tag
if (version_compare(phpversion(), '4.3', '>=')) {
echo htmlspecialchars(pg_result_status($rs, PGSQL_STATUS_STRING)), "<br/>\n";
} elseif ($data->conn->Affected_Rows() > 0) {
echo $data->conn->Affected_Rows(), " {$lang['strrowsaff']}<br/>\n";
}
// Otherwise output nothing...
break;
case PGSQL_EMPTY_QUERY:
break;
default:
break;
}
}
}
开发者ID:yxwzaxns,项目名称:DaoCloud_phpPgAdmin,代码行数:51,代码来源:sql.php
示例3: wypisz_tabele
function wypisz_tabele($wynik_zapytania, $naglowek)
{
echo '<table border="1">';
if ($naglowek == true) {
echo '<tr>';
for ($i = 0; $i < pg_numfields($wynik_zapytania); $i++) {
echo '<td>' . pg_field_name($wynik_zapytania, $i) . '</td>';
}
echo '</tr>';
}
for ($i = 0; $i < pg_numrows($wynik_zapytania); $i++) {
echo '<tr>';
for ($j = 0; $j < pg_numfields($wynik_zapytania); $j++) {
echo '<td>' . pg_result($wynik_zapytania, $i, $j) . '</td>';
}
echo '</tr>';
}
echo '</table>';
}
开发者ID:s179861,项目名称:vie_data_save,代码行数:19,代码来源:func_wypisz_tabele.php
示例4: wypisz_tabele
function wypisz_tabele($nazwa_tabeli)
{
$zapytanie = "select * from {$nazwa_tabeli}";
$wynik_zapytania = pg_exec(polacz(), $zapytanie);
echo '<table border="1">';
echo '<tr>';
for ($i = 0; $i < pg_numfields($wynik_zapytania); $i++) {
echo '<td>' . pg_field_name($wynik_zapytania, $i) . '</td>';
}
echo '</tr>';
for ($i = 0; $i < pg_numrows($wynik_zapytania); $i++) {
echo '<tr>';
for ($j = 0; $j < pg_numfields($wynik_zapytania); $j++) {
echo '<td>' . pg_result($wynik_zapytania, $i, $j) . '</td>';
}
echo '</tr>';
}
echo '</table>';
}
开发者ID:s179861,项目名称:vie_data_save,代码行数:19,代码来源:Z1.php
示例5: num_fields
function num_fields($result)
{
$numfields = pg_numfields($result);
return $numfields;
}
开发者ID:BackupTheBerlios,项目名称:ewebuki-svn,代码行数:5,代码来源:dbclass_postgres.php
示例6: NumberOfColumns
function NumberOfColumns($result)
{
if (!isset($this->highest_fetched_row[$result])) {
$this->SetError("Number of columns", "it was specified an inexisting result set");
return -1;
}
return pg_numfields($result);
}
开发者ID:wycus,项目名称:darmedic,代码行数:8,代码来源:metabase_pgsql.php
示例7: _query
function _query($sql, $inputarr = false)
{
if (!$this->_bindInputArray) {
// We don't have native support for parameterized queries, so let's emulate it at the parent
return ADODB_postgres64::_query($sql, $inputarr);
}
$this->_pnum = 0;
$this->_errorMsg = false;
// -- added Cristiano da Cunha Duarte
if ($inputarr) {
$sqlarr = explode('?', trim($sql));
$sql = '';
$i = 1;
$last = sizeof($sqlarr) - 1;
$localedata = localeconv();
foreach ($sqlarr as $v) {
if ($last < $i) {
$sql .= $v;
} else {
$sql .= $v . ' $' . $i;
}
$i++;
// pg_query_params may incorrectly format
// doubles using localized number formats, i.e.
// , instead of . for floats, violating the
// SQL standard. Format it locally.
$k = $i - 2;
// Use proper index for $inputarr to avoid going over the end
if ($k < $last) {
if (gettype($inputarr[$k]) == 'double') {
$inputarr[$k] = str_replace($localedata['decimal_point'], '.', $inputarr[$k]);
}
}
}
$rez = pg_query_params($this->_connectionID, $sql, $inputarr);
} else {
$rez = pg_query($this->_connectionID, $sql);
}
// check if no data returned, then no need to create real recordset
if ($rez && pg_numfields($rez) <= 0) {
if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
pg_freeresult($this->_resultid);
}
$this->_resultid = $rez;
return true;
}
return $rez;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:48,代码来源:adodb-postgres7.inc.php
示例8: confirm
function confirm($_POST)
{
# get vars
foreach ($_POST as $key => $value) {
${$key} = $value;
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($db, "string", 1, 20, "Invalid database.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to db
db_conn($db);
# ???? SQL (uppercase all the stupid sql keywords (\s space) ????
$sql = str_replace("\\", "", $sql);
$sql = preg_replace("/select\\s/i", "SELECT ", $sql);
$sql = preg_replace("/\\sfrom\\s/i", " FROM ", $sql);
$sql = preg_replace("/delete\\s/i", "DELETE ", $sql);
$sql = preg_replace("/\\swhere\\s/i", " WHERE ", $sql);
$sql = preg_replace("/\\sand\\s/i", " AND ", $sql);
$sql = preg_replace("/\\sor\\s/i", " OR ", $sql);
$sql = preg_replace("/\\slike\\s/i", " LIKE ", $sql);
$sql = preg_replace("/\\sasc/i", " ASC", $sql);
$sql = preg_replace("/\\sdesc/i", " DESC", $sql);
$sql = preg_replace("/\\sby\\s/i", " BY ", $sql);
$sql = preg_replace("/\\sorder\\s/i", " ORDER ", $sql);
$sql = preg_replace("/\\slimit\\s/i", " LIMIT ", $sql);
$sql = preg_replace("/update\\s/i", "UPDATE ", $sql);
$sql = preg_replace("/\\sset\\s/i", " SET ", $sql);
$sql = preg_replace("/\\svalues/i", " VALUES ", $sql);
$Rs = db_exec($sql) or die("Unable to access Cubit {$db}.");
$fldnum = pg_numfields($Rs);
for ($i = 0; $i < $fldnum; $i++) {
$flds[$i] = pg_fieldname($Rs, $i);
}
$confirm = "<center><h3>Result Analysis</h3>\r\n <h4>Database: {$db} </h4>\r\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n <tr><th colspan={$fldnum} align=center>Sql [ " . pg_numrows($Rs) . " rows affected ]</th></tr>\r\n <tr class='" . bg_class() . "'><td colspan={$fldnum} align=center>{$sql};</td></tr>\r\n <tr><td colspan={$fldnum}><br></td></tr>";
foreach ($flds as $key => $value) {
$confirm .= "<th>{$value}</th>";
}
$confirm .= "</tr>";
//List the produced Data
$i = 0;
if (pg_numrows($Rs) > 0) {
while ($data = pg_fetch_array($Rs)) {
$confirm .= "<tr class='" . bg_class() . "'>";
foreach ($flds as $key => $value) {
$confirm .= "<td>{$data[$value]}</td>";
}
$confirm .= "</tr>";
$i++;
}
} else {
$confirm .= "<tr class='" . bg_class() . "'><td colspan={$fldnum} align=center>There are results for you query</td></tr>";
}
$confirm .= "</table>\r\n <form action='" . SELF . "' method=post>\r\n <input type=hidden name=key value=confirm>\r\n <a name='down'>\r\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n <tr><td colspan=2><hr></td></tr>\r\n <tr class='bg-even'><td>SQL</td><td><input type=text size=60 name=sql value='{$sql}'></td></tr>\r\n <tr class='bg-odd'><td>Database</td><td><input type=text size=20 name=db value='{$db}'></td></tr>\r\n <tr><td align=right colspan=2><input type=submit value='Exec »'></td></tr>\r\n <tr><td colspan=2><hr></td></tr>\r\n </table>\r\n </form><br><br><br>";
return $confirm;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:66,代码来源:table-data.php
示例9: sql_numfields
function sql_numfields($query_id = 0)
{
if (!$query_id) {
$query_id = $this->query_result;
}
return $query_id ? @pg_numfields($query_id) : false;
}
开发者ID:rotvulpix,项目名称:php-nuke,代码行数:7,代码来源:postgres7.php
示例10: _initrs
function _initrs()
{
global $ADODB_COUNTRECS;
$qid = $this->_queryID;
$this->_numOfRows = $ADODB_COUNTRECS ? @pg_numrows($qid) : -1;
$this->_numOfFields = @pg_numfields($qid);
// cache types for blob decode check
for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) {
if (pg_fieldtype($qid, $i) == 'bytea') {
$this->_blobArr[$i] = pg_fieldname($qid, $i);
}
}
}
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:13,代码来源:adodb-postgres64.inc.php
示例11: sql_record
function sql_record($sql)
{
$result = db_query($sql) or die($sql);
$this->result = $result;
if ($result != false) {
$this->numrows = pg_numrows($result);
$this->numfields = pg_numfields($result);
} else {
$this->numrows = 0;
$this->numfields = 0;
}
}
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:12,代码来源:db_stdlib.php
示例12: num_fields
function num_fields()
{
return pg_numfields($this->Query_ID);
}
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:4,代码来源:cls_db_pgsql.php
示例13: _initrs
function _initrs()
{
global $ADODB_COUNTRECS;
$this->_numOfRows = $ADODB_COUNTRECS ? @pg_numrows($this->_queryID) : -1;
$this->_numOfFields = @pg_numfields($this->_queryID);
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:6,代码来源:adodb-netezza.inc.php
示例14: db_selectrecord
function db_selectrecord($nome, $record, $dbcadastro, $db_opcao = 3, $js_script = "", $nomevar = "", $bgcolor = "", $todos = "", $onchange = "")
{
if ($nomevar != "") {
$nome = $nomevar;
$nomedescr = $nomevar . "descr";
} else {
$nomedescr = $nome . "descr";
}
if ($db_opcao != 3 && $db_opcao != 5 && $db_opcao != 22 && $db_opcao != 33) {
?>
<select name="<?php
echo $nome;
?>
" id="<?php
echo $nome;
?>
"
onchange="js_ProcCod_<?php
echo $nome;
?>
('<?php
echo $nome;
?>
','<?php
echo $nomedescr;
?>
');<?php
echo $onchange;
?>
"
<?php
if ($dbcadastro == true) {
if ($db_opcao == 3 || $db_opcao == 22) {
echo " readonly ";
}
if ($db_opcao == 5) {
echo " disabled ";
}
}
echo $js_script;
?>
>
<?php
if ($todos != "") {
?>
<option value="<?php
echo $todos;
?>
" ><?php
echo $todos;
?>
</option>
<?php
}
for ($sqli = 0; $sqli < pg_numrows($record); $sqli++) {
$sqlv = pg_result($record, $sqli, 0);
?>
<option value="<?php
echo $sqlv;
?>
" <?php
echo @$GLOBALS[$nome] == $sqlv ? "selected" : "";
?>
><?php
echo $sqlv;
?>
</option>
<?php
}
?>
</select>
<?php
if (pg_numfields($record) > 0) {
?>
<select name="<?php
echo $nomedescr;
?>
" id="<?php
echo $nomedescr;
?>
"
onchange="js_ProcCod_<?php
echo $nome;
?>
('<?php
echo $nomedescr;
?>
','<?php
echo $nome;
?>
');<?php
echo $onchange;
?>
"
<?php
if ($dbcadastro == true) {
if ($db_opcao == 3 || $db_opcao == 22) {
echo " readonly ";
}
//.........这里部分代码省略.........
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:101,代码来源:db_funcoes.php
示例15: db_numfields
/**
*
* Returns the number of fields in this result set
*
* @param qhandle query result set handle
*
*/
function db_numfields($lhandle)
{
return @pg_numfields($lhandle);
}
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:11,代码来源:database-pgsql.php
示例16: get_table_csv
function get_table_csv($link, $table, $sep, $handler)
{
global $cfgQuotes;
$result = pg_exec($link, "SELECT * FROM {$cfgQuotes}{$table}{$cfgQuotes}") or pg_die(pg_errormessage(), "", __FILE__, __LINE__);
$i = 0;
if (pg_numrows($result)) {
while ($row = @pg_fetch_row($result, $i++)) {
unset($schema_insert);
for ($j = 0; $j < pg_numfields($result); $j++) {
if (!isset($row[$j])) {
$schema_insert .= "NULL" . $sep;
} elseif ($row[$j] != "") {
$schema_insert .= "{$row[$j]}" . $sep;
} else {
$schema_insert .= "" . $sep;
}
}
$schema_insert = ereg_replace($sep . "\$", "", $schema_insert);
// $schema_insert .= ")";
$handler(trim($schema_insert));
}
} else {
echo "{$strNoData} {$strFound}";
}
return true;
}
开发者ID:ColBT,项目名称:php_tut,代码行数:26,代码来源:lib.inc.php
示例17: db_sel_cfpess
function db_sel_cfpess($anofolha = null, $mesfolha = null, $campos = " * ")
{
if ($anofolha == null || trim($anofolha) == "") {
$anofolha = db_anofolha();
}
if ($mesfolha == null || trim($mesfolha) == "") {
$mesfolha = db_mesfolha();
}
if (trim($campos) == "") {
$campos = " * ";
}
$record_cfpess = pg_exec("select " . $campos . " from cfpess where r11_anousu = " . $anofolha . " and r11_mesusu = " . $mesfolha . " and r11_instit = " . DB_getsession("DB_instit"));
if ($record_cfpess == false) {
return false;
} else {
$num_cols = pg_numfields($record_cfpess);
$num_rows = pg_numrows($record_cfpess);
for ($index = 0; $index < $num_cols; $index++) {
$nam_campo = pg_fieldname($record_cfpess, $index);
global ${$nam_campo};
// echo "<BR> nam_campo --> $nam_campo";
${$nam_campo} = @pg_result($record_cfpess, 0, $nam_campo);
}
return $num_rows;
}
}
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:26,代码来源:db_libpessoal.php
示例18: numcampi_query
function numcampi_query($query)
{
$risul = pg_numfields($query);
return $risul;
}
开发者ID:briaguya,项目名称:sleepover---old,代码行数:5,代码来源:funzioni_postgresql.php
示例19: pg_connect
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
</head>
<meta charset="UTF-8"/>
<?php
$con = pg_connect("host=sbazy user=s181616 dbname=s181616 password=LuLmziBV");
$s = "select * from refleksje";
$r = pg_exec($con, $s);
$lw = pg_numrows($r);
$lk = pg_numfields($r);
print "<table class='table table-hover'>";
print "<th>Refleksja</th>";
print "<th>Tytul</th>";
for ($j = 0; $j < $lw; $j++) {
print "<tr>";
for ($i = 0; $i < $lk; $i++) {
print "<td>" . pg_result($r, $j, $i);
}
print "</tr>";
}
print "</table>";
?>
</html>
开发者ID:siekiera92,项目名称:PanTadeusz,代码行数:30,代码来源:select.php
示例20: _initrs
function _initrs()
{
global $ADODB_COUNTRECS;
$this->_numOfRows = $ADODB_COUNTRECS ? @pg_numrows($this->_queryID) : -1;
$this->_numOfFields = @pg_numfields($this->_queryID);
// cache types for blob decode check
for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) {
$f1 = $this->FetchField($i);
if ($f1->type == 'bytea') {
$this->_blobArr[$i] = $f1->name;
}
}
}
开发者ID:BackupTheBerlios,项目名称:osiswebprinter,代码行数:13,代码来源:adodb-postgres64.inc.php
注:本文中的pg_numfields函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论