Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pg_fetch_row(3) [php man page]

PG_FETCH_ROW(3) 														   PG_FETCH_ROW(3)

pg_fetch_row - Get a row as an enumerated array

SYNOPSIS
array pg_fetch_row (resource $result, [int $row]) DESCRIPTION
pg_fetch_row(3) fetches one row of data from the result associated with the specified $result resource. Note This function sets NULL fields to the PHP NULL value. PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $row - Row number in result to fetch. Rows are numbered from 0 upwards. If omitted or NULL, the next row is fetched. RETURN VALUES
An array, indexed from 0 upwards, with each value represented as a string. Database NULL values are returned as NULL. FALSE is returned if $row exceeds the number of rows in the set, there are no more rows, or on any other error. EXAMPLES
Example #1 pg_fetch_row(3) example <?php $conn = pg_pconnect("dbname=publisher"); if (!$conn) { echo "An error occurred. "; exit; } $result = pg_query($conn, "SELECT author, email FROM authors"); if (!$result) { echo "An error occurred. "; exit; } while ($row = pg_fetch_row($result)) { echo "Author: $row[0] E-mail: $row[1]"; echo "<br /> "; } ?> SEE ALSO
pg_query(3), pg_fetch_array(3), pg_fetch_object(3), pg_fetch_result(3). PHP Documentation Group PG_FETCH_ROW(3)

Check Out this Related Man Page

PG_RESULT_SEEK(3)														 PG_RESULT_SEEK(3)

pg_result_seek - Set internal row offset in result resource

SYNOPSIS
bool pg_result_seek (resource $result, int $offset) DESCRIPTION
pg_result_seek(3) sets the internal row offset in a result resource. PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $offset - Row to move the internal offset to in the $result resource. Rows are numbered starting from zero. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 pg_result_seek(3) example <?php // Connect to the database $conn = pg_pconnect("dbname=publisher"); // Execute a query $result = pg_query($conn, "SELECT author, email FROM authors"); // Seek to the 3rd row (assuming there are 3 rows) pg_result_seek($result, 2); // Fetch the 3rd row $row = pg_fetch_row($result); ?> SEE ALSO
pg_fetch_row(3), pg_fetch_assoc(3), pg_fetch_array(3), pg_fetch_object(3), pg_fetch_result(3). PHP Documentation Group PG_RESULT_SEEK(3)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert rows with computations of next row

Hello folks, I have data collected in every 3 hours. But, I would like to expand this to 1 hour interval by equally dividing with next row. For example, I want to keep the first value 1987-01-01-00z 2.0, but following all record should be re-written as follow. 1987-01-01-03z 5.0 becomes... (11 Replies)
Discussion started by: Jae
11 Replies

2. Shell Programming and Scripting

Merging of rows

Hi guys, Wish you all a very Happy New Year!!!. Thanks in advance. I want to read a file and merge the rows which have '\n' in it. The rows could be > 50,000 bytes. The script should merge all the rows till the next row starts with word 'Type|'. ex.... (24 Replies)
Discussion started by: ssachins
24 Replies

3. Shell Programming and Scripting

extract particular lines from text file

I have two files file A which have a number in every row and file B which contains few hundred thousand rows with about 300 characters in each row (csv) What I need is to extract whole rows from B file (only these which numbers are indicated in A file) I also need to use cygwin. Any... (7 Replies)
Discussion started by: gunio
7 Replies

4. Shell Programming and Scripting

Bash script

Hi i read a file row by row and cut into fields. and store the content of fields to a variable. when i use the variable in if condition it giving me error. the error is : integer expression expected storing it in the variable like this Tval=`echo ${line} | cut -d "#" -f 2` ... (6 Replies)
Discussion started by: barani75
6 Replies

5. Shell Programming and Scripting

Setting script exit code

#!/bin/ksh row=`sed '1!G;h;$!d' file1.xml | head -2| tail -1` echo "$row" | awk -F"" '{$esum=$5}' row=`sed '1!G;h;$!d' file2.xml | head -2| tail -1` echo "$row" | awk -F"" '{$isum=$5+$19}' echo "Exp:$esnum" echo "Imp:$isum" if then echo "Matched" else echo "Not matched" fi ... (6 Replies)
Discussion started by: skyineyes
6 Replies

6. UNIX for Advanced & Expert Users

Converting rows to a single row

Hi all I have a file as below : Development System User Production i want to convert the file to below format: "Development","System","User","Production" Is it possible with UNIX ? if so can you please give me some direction on it ? Thanks, Satya Use code tags please, ty. (10 Replies)
Discussion started by: satyaranjon
10 Replies

7. UNIX for Dummies Questions & Answers

To find the Row number

Hi Can any one tell me what is the command to find out the row id or row number for a particular record Thanks sri (6 Replies)
Discussion started by: laxmi131
6 Replies

8. Solaris

How to delete a row in a file

(8 Replies)
Discussion started by: natraj005
8 Replies

9. Shell Programming and Scripting

Get a group of line from different file and put them into one file row by row

hi guys, today i'm stuck in a new problem. the title explain more or less but a particular had been omitted. So i'm going to describe below the situation with an example. I have different html files and each of them have a consecutive lines group inside that i want to extract. example: ... (8 Replies)
Discussion started by: sbobotex
8 Replies

10. Shell Programming and Scripting

Averaging each row with null values

Hi all, I want to compute for the average of a file with null values (NaN) for each row. any help on how to do it. the sample file looks like this. 1.4 1.2 1.5 NaN 1.6 1.3 1.1 NaN 1.3 NaN 2.4 1.3 1.5 NaN 1.5 NaN 1.2 NaN 1.4 NaN I need to do a row-wise averaging such that it will sum only... (14 Replies)
Discussion started by: ida1215
14 Replies

11. Shell Programming and Scripting

Sort each row (horizontally) in AWK or any

Hello, How to sort each row in a document with numerical values and with more than one row. Example Input data (file1.txt): 4 6 8 1 7 2 12 9 6 10 6 1 14 5 7 and I want the the output to look like this(file2.txt): 1 4 6 7 8 2 6 9 10 12 1 5 6 7 14 I've tried sort -n file1.txt >... (12 Replies)
Discussion started by: joseamck
12 Replies

12. UNIX for Dummies Questions & Answers

Row number

Dear All, I am new to UNIX . Please tell me how to retreive row number from the file. In AS/400 we can retreive RRN(Relative record number ) from the file, In same way what is the option to take relative record number from the file in UNIX. It may be very easy query, but still I need ur... (9 Replies)
Discussion started by: coolmaninit
9 Replies

13. Shell Programming and Scripting

Removing Duplicate Rows in a file

Hello I have a file with contents like this... Part1 Field2 Field3 Field4 (line1) Part2 Field2 Field3 Field4 (line2) Part3 Field2 Field3 Field4 (line3) Part1 Field2 Field3 Field4 (line4) Part4 Field2 Field3 Field4 (line5) Part5 Field2 Field3 Field4 (line6) Part2 Field2 Field3 Field4... (7 Replies)
Discussion started by: ekbaazigar
7 Replies

14. Shell Programming and Scripting

awk find the first matching row

I would like to find the first matching row and continue to search from the matching row. if column3 equal to 1 in the row, find the next matching row based on the criteria below. column3 in the matching row equal to 0 and column2 equal to column2 in the matching row test.csv - test data ... (7 Replies)
Discussion started by: chailee
7 Replies

15. UNIX for Beginners Questions & Answers

Egrep find word that occurs twice in a row

Hi there I am trying to figure out and understand what the syntax would be to egrep lines that have a word occur twice in a row. the two words obviously should have a space between them and also it has to be case sensitive which I believe grep is by deffault. the closest I have come is... grep... (7 Replies)
Discussion started by: spo_2138
7 Replies