本文整理汇总了PHP中pg_NumRows函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_NumRows函数的具体用法?PHP pg_NumRows怎么用?PHP pg_NumRows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg_NumRows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNumRows
public function getNumRows($name)
{
if (isset($this->result[$name]) && (gettype($this->result[$name]) == 'object' || gettype($this->result[$name]) == 'resource')) {
return pg_NumRows($this->result[$name]);
}
return 0;
}
示例2: notify_emails
function notify_emails($dbid, $req_id)
{
if ("{$req_id}" == "") {
return "";
}
$query = "SELECT email, fullname FROM usr, request_interested ";
$query .= "WHERE request_interested.user_no = usr.user_no ";
$query .= " AND request_interested.request_id = {$req_id} ";
$query .= " AND usr.active ";
$query .= "UNION ";
$query .= "SELECT email, fullname FROM usr, request_allocated ";
$query .= "WHERE request_allocated.allocated_to_id = usr.user_no ";
$query .= " AND request_allocated.request_id = {$req_id} ";
$query .= " AND usr.active ";
$peopleq = awm_pgexec($dbid, $query, "notify-eml");
$to = "";
if ($peopleq) {
$rows = pg_NumRows($peopleq);
for ($i = 0; $i < $rows; $i++) {
$interested = pg_Fetch_Object($peopleq, $i);
if ($i > 0) {
$to .= ", ";
}
$to .= "{$interested->fullname} <{$interested->email}>";
}
}
return $to;
}
示例3: get_system_list
function get_system_list($access = "", $current = 0, $maxwidth = 50)
{
global $dbconn;
global $session, $roles;
$system_id_list = "";
function int_val(&$item)
{
$item = strval(intval($item));
}
if (is_array($current)) {
array_walk($current, 'int_val');
} else {
$current = intval("{$current}");
}
$query = "SELECT work_system.system_id, system_desc ";
$query .= "FROM work_system WHERE active ";
if ($access != "" && !is_member_of('Admin', 'Support')) {
$query .= " AND EXISTS (SELECT system_usr.system_id FROM system_usr WHERE system_usr.system_id=work_system.system_id";
$query .= " AND user_no={$session->user_no} ";
$query .= " AND role~*'[{$access}]') ";
}
if (is_array($current)) {
$query .= " OR work_system.system_id IN (" . implode(",", $current) . ") ";
} else {
if ($current != "") {
$query .= " OR work_system.system_id={$current}";
}
}
$query .= " ORDER BY LOWER(system_desc);";
$rid = awm_pgexec($dbconn, $query);
if (!$rid) {
return;
}
if (pg_NumRows($rid) > 0) {
// Build table of systems found
$rows = pg_NumRows($rid);
for ($i = 0; $i < $rows; $i++) {
$system_id = pg_Fetch_Object($rid, $i);
$system_id_list .= "<option value=\"" . urlencode($system_id->system_id) . "\"";
if (is_array($current) && in_array($system_id->system_id, $current, true) || "{$system_id->system_id}" == "{$current}") {
$system_id_list .= " SELECTED";
}
$system_id->system_desc = substr($system_id->system_desc, 0, $maxwidth);
$system_id_list .= ">{$system_id->system_desc}</option>\n";
}
}
return $system_id_list;
}
示例4: execute
function execute($sql, $db, $type = "mysql")
{
$start = $this->row * $this->numrowsperpage;
if ($type == "mysql") {
$result = mysql_query($sql, $db);
$this->total_records = mysql_num_rows($result);
$sql .= " LIMIT {$start}, {$this->numrowsperpage}";
$result = mysql_query($sql, $db);
} elseif ($type == "pgsql") {
$result = pg_Exec($db, $sql);
$this->total_records = pg_NumRows($result);
$sql .= " LIMIT {$this->numrowsperpage}, {$start}";
$result = pg_Exec($db, $sql);
}
return $result;
}
示例5: get_user_list
function get_user_list($roles = "", $org = "", $current)
{
global $dbconn;
global $session;
$user_list = "";
$query = "SELECT DISTINCT usr.user_no, usr.fullname, organisation.abbreviation ";
$query .= "FROM usr , organisation";
$query .= " WHERE usr.active ";
$query .= " AND usr.org_code = organisation.org_code ";
if ($roles != "") {
$role_array = split(',', $roles);
$in_roles = "";
foreach ($role_array as $v) {
$in_roles .= $in_roles == "" ? "" : ",";
$in_roles .= "'{$v}'";
}
$query .= "AND EXISTS (SELECT role_member.user_no FROM role_member JOIN roles USING(role_no) ";
$query .= "WHERE role_member.user_no = usr.user_no ";
$query .= "AND roles.role_name IN ({$in_roles}) )";
}
if ("{$org}" != "") {
$query .= " AND usr.org_code='{$org}' ";
}
$query .= " ORDER BY usr.fullname; ";
$rid = awm_pgexec($dbconn, $query, "userlist", false, 7);
if (!$rid) {
echo "<p>{$query}";
} else {
if (pg_NumRows($rid) > 0) {
// Build table of users found
$rows = pg_NumRows($rid);
for ($i = 0; $i < $rows; $i++) {
$user = pg_Fetch_Object($rid, $i);
$user_list .= "<OPTION VALUE=\"{$user->user_no}\"";
if (is_array($current) && in_array($user->user_no, $current, true) || "{$user->user_no}" == "{$current}") {
$user_list .= " selected=\"SELECTED\"";
}
$user->fullname = substr($user->fullname, 0, 25) . " ({$user->abbreviation})";
$user_list .= ">{$user->fullname}";
}
}
}
return $user_list;
}
示例6: execute
function execute($sql, $db, $type = "mysql")
{
global $total_records, $row, $numtoshow;
$numtoshow = $this->numrowsperpage;
if (!isset($row)) {
$row = 0;
}
$start = $row * $numtoshow;
if ($type == "mysql") {
$result = mysql_query($sql, $db);
$total_records = mysql_num_rows($result);
$sql .= " LIMIT {$start}, {$numtoshow}";
$result = mysql_query($sql, $db);
} elseif ($type == "pgsql") {
$result = pg_Exec($db, $sql);
$total_records = pg_NumRows($result);
$sql .= " LIMIT {$numtoshow}, {$start}";
$result = pg_Exec($db, $sql);
}
return $result;
}
示例7: listOptionsLabel
function listOptionsLabel($dataset, $choixdef)
{
global $database;
$result = pg_Exec($database, "SELECT * FROM " . $dataset);
$Nbr = pg_NumRows($result);
for ($i = 0; $i < $Nbr; $i++) {
$tablo[$i] = pg_fetch_array($result, $i);
}
if ($Nbr > 2) {
sort($tablo);
}
echo "<select name=liste_" . $dataset . ">\n";
for ($i = 0; $i < $Nbr; $i++) {
list($cle, $label) = $tablo[$i];
if ($cle == $choixdef) {
echo " <option selected>" . $cle . " = " . $label . "</option>\n";
} else {
echo " <option>" . $cle . " = " . $label . "</option>\n";
}
}
echo "</select>\n";
return 1;
}
示例8: get_code_list
function get_code_list($table, $field, $current = "", $misc = "", $tag = "option", $varname = "")
{
global $dbconn;
$query = "SELECT * FROM lookup_code WHERE source_table = '{$table}' AND source_field = '{$field}' ORDER BY source_table, source_field, lookup_seq, lookup_code";
$rid = awm_pgexec($dbconn, $query, "codelist", false);
$rows = pg_NumRows($rid);
$lookup_code_list = "";
if ($tag != "option") {
$prestuff = "input type=";
$selected = " checked";
} else {
$prestuff = "";
$selected = " selected";
}
for ($i = 0; $i < $rows; $i++) {
$lookup_code = pg_Fetch_Object($rid, $i);
$lookup_code_list .= "<{$prestuff}{$tag} value=\"{$lookup_code->lookup_code}\"";
if ("{$varname}" != "") {
$lookup_code_list .= " name={$varname}";
}
if ("{$lookup_code->lookup_code}" == "{$current}") {
$lookup_code_list .= $selected;
}
$lookup_code_list .= ">";
$lookup_code_list .= "{$lookup_code->lookup_desc}";
if ("{$misc}" != "" && "{$lookup_code->lookup_misc}" != "") {
$lookup_code_list .= " - {$lookup_code->lookup_misc}";
}
if ("{$tag}" == "option") {
$lookup_code_list .= "</{$tag}>";
} else {
$lookup_code_list .= " \n";
}
}
return $lookup_code_list;
}
示例9: Sincronizar
function Sincronizar($db)
{
$rows = 0;
// Number of rows
$qid = 0;
// Query result resource
// See PostgreSQL developer manual (www.postgresql.org) for system table spec.
// Get catalog data from system tables.
$sql = 'SELECT * FROM migracion.f_sincronizacion()';
$qid = pg_Exec($db, $sql);
// Check error
if (!is_resource($qid)) {
print 'Error en la Sincronizacion';
return null;
}
$rows = pg_NumRows($qid);
// Store meta data
for ($i = 0; $i < $rows; $i++) {
$res = pg_Result($qid, $i, 0);
// Field Name
}
echo 'Sincronizacion terminada (' . $res . ') - ' . date("m-d-Y H:i:s") . '<BR>';
return $res;
}
示例10: execute
function execute($sql, $db, $type = "mysql")
{
global $total_records, $row, $numtoshow;
$numtoshow = $this->numrowsperpage;
if (!isset($_GET['row'])) {
$row = 0;
} else {
$row = $_GET['row'];
}
$start = $row * $numtoshow;
if ($type == "mysql") {
// echo " the sql statement is --".$sql."and Db is --".$db;
$query_result = mysql_query($sql, $db);
//$total_records = mysql_num_rows($query_result);
$sql .= " LIMIT {$start}, {$numtoshow}";
$query_result = mysql_query($sql, $db);
} elseif ($type == "pgsql") {
$query_result = pg_Exec($db, $sql);
$total_records = pg_NumRows($query_result);
$sql .= " LIMIT {$numtoshow}, {$start}";
$query_result = pg_Exec($db, $sql);
}
return $query_result;
}
示例11: rtf
$numAcredit = ($_REQUEST['pagFin'] - $_REQUEST['pagInicio'] + 1) * 20;
$desplazamiento = $_REQUEST['pagInicio'] * 20;
$consulta = "Select * from usuario where estado='3' order by ape1 limit " . $numAcredit . " offset " . $desplazamiento . ";";
}
}
$plantilla = "plantilla.rtf";
$salida = rtf($consulta, $plantilla, "acreditaciones.rtf");
descarga($salida);
// Se redirige a la página de administración
echo "<script type='text/javascript'> location.href='imprimirAcreditaciones.php'; </script>";
} else {
$usuariosconfirm = ejecutaConsulta("Select * from usuario where estado='3';");
$numrowsconfirm = pg_NumRows($usuariosconfirm);
$numrowsconfirm = (int) ($numrowsconfirm / 20) + 1;
$usuariosinscrit = ejecutaConsulta("Select * from usuario where estado='1';");
$numrowsinscrit = pg_NumRows($usuariosinscrit);
$numrowsinscrit = (int) ($numrowsinscrit / 20) + 1;
?>
<FORM name="formImpresion" METHOD="post" ACTION="imprimirRTF.php" target="_self">
<p>El número de páginas de acreditaciones para personas inscritas sin confirmar actual es: <?php
echo $numrowsinscrit;
?>
</p>
<p>El número de páginas de acreditaciones para personas inscritas y confirmadas actual es: <?php
echo $numrowsconfirm;
?>
</p>
<p>Elegir el tipo de usuario del que se desea imprimir acreditaciones:
<label for="inscritos">Inscritos<input id="inscritos" type="radio" value="1" checked name="tipousuario"></label>
示例12: numrows
function numrows($result)
{
return pg_NumRows($result);
}
示例13: printf
if ($conn == "") {
printf("{$s}%s%s", "Unable to connect to application.<br>", "Please verify that the application is running and ", "listening on port {$port}.<br>");
exit;
}
// Headings
print "<table border=3 cellpadding=4 align=center width=65%>\n";
print "<tr><th>Table Name</th><th>Description</th></tr>\n";
// execute query
$command = "SELECT name, help, nrows FROM rta_tables";
$result = pg_exec($conn, $command);
if ($result == "") {
print "<p><font color=\"red\" size=+1>SQL Command failed!</p>";
print "<p>Command: {$command}</p>\n";
exit;
}
for ($row = 0; $row < pg_NumRows($result); $row++) {
$tblname = pg_result($result, $row, 0);
$tblhelp = pg_result($result, $row, 1);
$tblrows = pg_result($result, $row, 2);
print "<tr>\n<td><a href=rta_view.php?table={$tblname}&offset=0";
print "&nrows={$tblrows}&port={$port}>{$tblname}</a></td>\n";
print "<td>{$tblhelp}</td></tr>\n";
}
print "</table>\n";
// free the result and close the connection
pg_freeresult($result);
pg_close($conn);
?>
</body>
</html>
示例14: pg_Exec
$user_no = "";
$query = "SELECT user_no FROM usr WHERE username=LOWER('{$l}') and password=LOWER('{$p}')";
$result = pg_Exec($dbconn, $query);
if (pg_NumRows($result) > 0) {
$user_no = pg_Result($result, 0, "user_no");
}
$requests = "<p><small>";
if ("{$user_no}" != "") {
$query = "SELECT DISTINCT request.request_id, brief, last_activity, ";
$query .= "lookup_desc AS status_desc, severity_code ";
$query .= "FROM request, request_interested, lookup_code AS status ";
$query .= "WHERE request.request_id=request_interested.request_id ";
$query .= "AND status.source_table='request' ";
$query .= "AND status.source_field='status_code' ";
$query .= "AND status.lookup_code=request.last_status ";
$query .= "AND request_interested.user_no={$user_no} ";
$query .= "AND request.active ";
$query .= "AND request.last_status~*'[AILNRQA]' ";
$query .= "ORDER BY request.severity_code DESC LIMIT 20; ";
$result = pg_Exec($dbconn, $query);
if (!$result) {
error_log("wrms wap/inc/getRequests.php query error: {$query}", 0);
}
for ($i = 0; $i < pg_NumRows($result); $i++) {
$thisrequest = pg_Fetch_Object($result, $i);
$requests .= "<a href=\"wrms.php?id={$thisrequest->request_id}\">" . tidy($thisrequest->brief) . "</a><br/>\n";
}
} else {
$requests .= "I'm sorry you must login first";
}
$requests .= "</small></p>";
示例15: awm_pgexec
$error_loc = "get-request-roles.php";
$error_qry = "{$query}";
include "error.php";
}
if ($rid && pg_NumRows($rid) > 0) {
$allocated_to = TRUE;
}
/* Is the person client or support manager for this (or any?) system? */
$query = "SELECT * FROM system_usr WHERE system_usr.user_no={$session->user_no}";
$query .= " AND system_usr.role ~ '[CS]' ";
if ($is_request) {
$query .= " AND system_usr.system_id = '{$request->system_id}' ";
}
$rid = awm_pgexec($dbconn, $query, "req-roles2");
if (!$rid) {
$error_loc = "get-request-roles.php";
$error_qry = "{$query}";
include "error.php";
}
if ($rid && pg_NumRows($rid) > 0) {
$sysman_role = pg_fetch_object($rid, 0);
if (eregi('S', $sysman_role->role)) {
$sysmgr = TRUE;
} else {
$cltmgr = TRUE;
}
}
// Also set $sysmgr if the person is Admin...
if (is_member_of('Admin')) {
$sysmgr = TRUE;
}