PG_FIELD_IS_NULL(3)PG_FIELD_IS_NULL(3)pg_field_is_null - Test if a field is SQL NULLSYNOPSIS
int pg_field_is_null (resource $result, int $row, mixed $field)
DESCRIPTION
int pg_field_is_null (resource $result, mixed $field)
pg_field_is_null(3) tests if a field in a PostgreSQL result resource is SQL NULL or not.
Note
This function used to be called pg_fieldisnull(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, current row is fetched.
o $field
- Field number (starting from 0) as an integer or the field name as a string.
RETURN VALUES
Returns 1 if the field in the given row is SQL NULL, 0 if not. FALSE is returned if the row is out of range, or upon any other error.
EXAMPLES
Example #1
pg_field_is_null(3) example
<?php
$dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
$res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
if ($res) {
if (pg_field_is_null($res, 0, "year") == 1) {
echo "The value of the field year is null.
";
}
if (pg_field_is_null($res, 0, "year") == 0) {
echo "The value of the field year is not null.
";
}
}
?>
PHP Documentation Group PG_FIELD_IS_NULL(3)
Check Out this Related Man Page
PG_FETCH_RESULT(3)PG_FETCH_RESULT(3)pg_fetch_result - Returns values from a result resourceSYNOPSIS
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)
Hallo All, this is my code below. The problem happens under section A because field $9 sometimes does not contain a number it contains a (:) and a number is contained in field $10 as result under sectionC we get a syntax error @
echo "scale=1; $aa+$ee+$ff"|bc > /tmp/pax/c3.txt
So i need to... (5 Replies)
Hi
I have a file like
a,1
b,2
d,3
a,2
b,3
c,7
Result Desired:
a,3
b,5
d,3
c,7
i.e on the bases of 1st field the addition is done of the 2nd field and result printed out. (3 Replies)
Hi,
I need to get the previous year as 07 instead of just 7. I'm running the following for this..
yy=`date '+%y'`
((Preyy = yy - 01))
echo ${Preyy}
Here, instead of 07 i'm getting 7 as result. Please Help.
Thanks,
RRVARMA (3 Replies)
I want to send email for every row comes out of following SQL statement
thank you for your help.
*****SQL STATEMENT******
Select SCUSER AS "USER IDS" , SCEUSER AS "LOCKED OUT" FROM SYS.7333.F98OWSEC;
*******OUPUT COMES LIKE THIS AND ONE EMAIL COMES AS PER SCRIPT BELOW******
******BUT... (4 Replies)
I have a code unit based on which i have this code snippet
year='2009'
echo year is $year
if )@()@()@() ]]
then
echo 'year in error'
fi
echo end of program
Here i want to find whether all the characters in the variable year are numbers. I am not sure whether this works or not because... (5 Replies)
Hi Guys,
my situation is that i'm a 25 year old IT proffessional but due to current reccession market im being forced to work in a different field as comms support guy. my first job was with a software consultancy company working as a application support role but due to being made redundant i... (11 Replies)
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)
Hi,
I've a file as below-
I need to delete only the part of the line after the pattern 'extent /lock' and my output has to be like below.
Thanks (7 Replies)
Hi,
I have a fixed width file.
The way this file works is say for example there are 30 columns in it each with different sizes say 10,5,2, etc...
If data in a field is less than the field size the rest of it is loaded with spaces.
I would like an awk command to that would replace
I have... (8 Replies)
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)
Gents,
Please can you help me with this.
When column 49 == 2
Need to do the following changes;
Change previous row field (substr$0,45,4)-1
Change previous row field (substr$0,72,5)+2
Change actual row field (substr$0,40,4)+1
Change actual row field (substr$0,49,1)-1
Change actual... (6 Replies)
Hi,
I am trying to extract data where first field unique value and 4th field of next row is grater than first row 4th field.
input data is a below:
7035719974,20-jul-2016 07:42:51,07:42:51,074251,1
7035719974,20-jul-2016 07:43:57,07:43:57,074357,2
7399206761,20-jul-2016... (2 Replies)