PG_NUM_FIELDS(3)PG_NUM_FIELDS(3)pg_num_fields - Returns the number of fields in a resultSYNOPSIS
int pg_num_fields (resource $result)
DESCRIPTION pg_num_fields(3) returns the number of fields (columns) in a PostgreSQL result resource.
Note
This function used to be called pg_numfields(3).
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
The number of fields (columns) in the result. On error, -1 is returned.
EXAMPLES
Example #1
pg_num_fields(3) example
<?php
$result = pg_query($conn, "SELECT 1, 2");
$num = pg_num_fields($result);
echo $num . " field(s) returned.
";
?>
The above example will output:
2 field(s) returned.
SEE ALSO pg_num_rows(3), pg_affected_rows(3).
PHP Documentation Group PG_NUM_FIELDS(3)
Check Out this Related Man Page
PG_AFFECTED_ROWS(3)PG_AFFECTED_ROWS(3)pg_affected_rows - Returns number of affected records (tuples)SYNOPSIS
int pg_affected_rows (resource $result)
DESCRIPTION pg_affected_rows(3) returns the number of tuples (instances/records/rows) affected by INSERT, UPDATE, and DELETE queries.
Since PostgreSQL 9.0 and above, the server returns the number of SELECTed rows. Older PostgreSQL return 0 for SELECT.
Note
This function used to be called pg_cmdtuples(3).
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
The number of rows affected by the query. If no tuple is affected, it will return 0.
EXAMPLES
Example #1
pg_affected_rows(3) example
<?php
$result = pg_query($conn, "INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples = pg_affected_rows($result);
echo $cmdtuples . " tuples are affected.
";
?>
The above example will output:
1 tuples are affected.
SEE ALSO pg_query(3), pg_query_params(3), pg_execute(3), pg_num_rows(3).
PHP Documentation Group PG_AFFECTED_ROWS(3)
Hello all,
I do not understand the meaning of some columns in the result of executing 'ls -l'. For example, i got the following result by run 'ls -l'
total 3531
-rw-r--r-- 1 root root 1351680 Oct 17 20:50 fileindex.rpm
-rw-r--r-- 1 root root 16384 Oct 17 20:50 groupindex.rpm ... (5 Replies)
Hi All,
I have a file which has the conetent like this:-
SELECT F1, F2, F3, F1, F5, F2 FROM T1
I Want to replace multiple occurences of F1 and F2 with single field.
Required Output Should be:
SELECT F1, F2, F3,F5 FROM T1
Please guide me how can i do this?
Thanks in Advance.
Dilip (1 Reply)
I have a file with approximately 262,000 fields and I want to split it according to pairs of fields. The fields have headers and I want to create smaller files with just the columns between the fields (specified fields inclusive).
For example, I just want the columns "set" and "test", with the... (3 Replies)
Hi Folks,
I have a file with 22 columns. In which, I need to remove nulls if found at $2, $4, $14 & $16. Then, needs to compare the fields such as $2 == $14 && $4 == $16. The final output will print all the fields where the above conditions are satisfied.
Could you please anyone help me... (6 Replies)
Hi,
I'm struggling with a problem at the minute. Basically, I have a file with >1000 columns / fields (with headers), each containing a variable number of values. I would like to stack each column such that all the data appears in a single column, e.g. the first value of column 2 is moved to... (5 Replies)