Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pg_free_result(3) [php man page]

PG_FREE_RESULT(3)														 PG_FREE_RESULT(3)

pg_free_result - Free result memory

SYNOPSIS
bool pg_free_result (resource $result) DESCRIPTION
pg_free_result(3) frees the memory and data associated with the specified PostgreSQL query result resource. This function need only be called if memory consumption during script execution is a problem. Otherwise, all result memory will be auto- matically freed when the script ends. Note This function used to be called pg_freeresult(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
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 pg_free_result(3) example <?php $db = pg_connect("dbname=users user=me") || die(); $res = pg_query($db, "SELECT 1 UNION ALL SELECT 2"); $val = pg_fetch_result($res, 1, 0); echo "First field in the second row is: ", $val, " "; pg_free_result($res); ?> The above example will output: First field in the second row is: 2 SEE ALSO
pg_query(3), pg_query_params(3), pg_execute(3). PHP Documentation Group PG_FREE_RESULT(3)

Check Out this Related Man Page

PG_FETCH_RESULT(3)														PG_FETCH_RESULT(3)

pg_fetch_result - Returns values from a result resource

SYNOPSIS
string pg_fetch_result (resource $result, int $row, mixed $field) DESCRIPTION
string pg_fetch_result (resource $result, mixed $field) pg_fetch_result(3) returns the value of a particular row and field (column) in a PostgreSQL result resource. Note This function used to be called pg_result(3). 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, next row is fetched. o $field - A string representing the name of the field (column) to fetch, otherwise an int representing the field number to fetch. Fields are numbered from 0 upwards. RETURN VALUES
Boolean is returned as "t" or "f". All other types, including arrays are returned as strings formatted in the same default PostgreSQL man- ner that you would see in the psql program. Database NULL values are returned as NULL. FALSE is returned if $row exceeds the number of rows in the set, or on any other error. EXAMPLES
Example #1 pg_fetch_result(3) example <?php $db = pg_connect("dbname=users user=me") || die(); $res = pg_query($db, "SELECT 1 UNION ALL SELECT 2"); $val = pg_fetch_result($res, 1, 0); echo "First field in the second row is: ", $val, " "; ?> The above example will output: First field in the second row is: 2 SEE ALSO
pg_query(3), pg_fetch_array(3). PHP Documentation Group PG_FETCH_RESULT(3)
Man Page

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to Output result to a non-delimitted file

Hello I need to run an sql script and then the output result to be in non-delimitted file What is the execution command to obtain this. For eg: the following outputs the result to a space delimitted file db2batch -d ${EC_DB2_DBNAME} -f ${TMP_SCRIPT_NAME} -a ${CURR_DB_ID}/${CURR_DB_PWD} -r... (1 Reply)
Discussion started by: cosec
1 Replies

2. Shell Programming and Scripting

Problem in Passing sql query for a script

Unix prompt ========= echo "Enter the query" read q ========== User has entered : SELECT * FROM employee ===================== Now the problem starts.. echo $q Output: SELECT "all files names in the PWD" FROM employee ================================================ ... (5 Replies)
Discussion started by: Niroj
5 Replies

3. Programming

Current and Peak Memory consumption of my program?

Hi, my C++ program does some memory consuming tasks and runs several minutes. During execution time, I want to print information on the current memory consumption and peak memory consumption of my program into a logfile. How can I retrieve this information, i.e. which functions are available... (0 Replies)
Discussion started by: DarthVader77
0 Replies

4. Red Hat

To get the memory in MB

Hi I am trying to get the memory in the box using the belkow command. this is giving me the proper result in KB's. I would like to convert it into MB's. cat /proc/meminfo | grep MemTotal | cut -d " " -f6 32962184 But when I execute the below command, its throwing the error. expr ` \(... (3 Replies)
Discussion started by: chromegg
3 Replies

5. SCO

Partition Resize / Creation

Hello, I'm new to SCO and I require some help... I have an OLD HD which is about to die and I want to replace it with a new HD. When I clone the HD with either Acronis or Ghost it wont allow me to resize the UNIX partition and I'm stuck with 80% of the new drive as unused space. I... (7 Replies)
Discussion started by: dochost
7 Replies

6. AIX

Memory consumption issue in AIX box

Hi, monitor memory usage on AIX machine on any day of the week from 3:00 PM ET to 5:00 PM ET - Povide min and max memory consumption. Determine if all of the available memory is visible to the operating system. If it is not, determine the amount of memory which may be allocated to the... (3 Replies)
Discussion started by: Rookie_newbie
3 Replies

7. Shell Programming and Scripting

php script problem

$result = shell_exec("/sbin/checkscript.sh jdoe"); echo "$result" ; i am running a script through php. the script is /sbin/checkscript jdoe. this script is supposed to output something similar to this: ################################ #### Welcome John Doe... (0 Replies)
Discussion started by: SkySmart
0 Replies

8. UNIX for Dummies Questions & Answers

A lil help for my problem guys SELECT

i need to create a script using the patterns below. im not good in script writing so i need your help guys.. i thing i can use SELECT here but dont really know how to start. 1. Create a script named exercise1.sh that will generate a menu with the following items: a. Current Logins b. Last... (2 Replies)
Discussion started by: JONATHAN0919
2 Replies