note 32644 added to function.ora-fetch-into
| From: | kamas at telkom dot net | Date: | Tue, 03 Jun 2003 18:19:59 +0000 |
| Subject: | note 32644 added to function.ora-fetch-into | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49645@lists.php.net to get a copy of this message | ||
becareful when fetching data with NULL value using ora_fetch_into().
table example :
field1 field2 nullable
----------------------
a b c
w w NULL
d d NULL
e e x
//php script :
$curs = ora_open($conn);
ora_parse($curs, "SELECT * FROM tableblah");
ora_exec($curs);
while(ora_fetch_into($curs, &$dt, ORA_FETCHINTO_ASSOC)) {
echo $dt['field1'] . " - " . $dt['field2'] . " - " .
$dt['nullable'] . "<br>\n";
}
ora_close($curs);
the above code will print:
a - b - c
w - w - c
d - d - c
e - e - x
if the value of the nullable field is NULL it will contains value from the
row before. to avoid this you can use :
while(ora_fetch_into($curs, &$dt, ORA_FETCHINTO_ASSOC)) {
...
$dt['nullable'] = "";
}
to set $dt['nullable'] to an empty value.
----
Manual Page -- http://www.php.net/manual/en/function.ora-fetch-into.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32644
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32644&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32644&report=yes