note 73225 added to ref.ingres
| From: | corysbrain-ondrugs at yahoo dot com | Date: | Wed, 14 Feb 2007 02:57:39 +0000 |
| Subject: | note 73225 added to ref.ingres | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123345@lists.php.net to get a copy of this message | ||
On the three versions of Linux/Ingres I've worked on, I've always had to modify the
following line in the example above:
while ($iirelation = ingres_fetch_object($link)) {
to:
while ($iirelation = ingres_fetch_object()) {
If not, PHP will return "Undefined property" notices.
However, it's my understanding that the following is the proper way to access the database (it
works as expected):
<?php
// Connecting, selecting database
$link = ingres_connect('database', 'user', 'password')
or die('Could not connect: ' . ingres_error($link));
echo 'Connected successfully';
// Select from a table that exists in all Ingres databases
$query = 'SELECT * FROM iirelation';
$rs = ingres_query($query,$link) or die('Query failed: ' .
ingres_error($link));
// Print results in HTML
// relid - table name
// relowner - table owner
echo "<table>\n";
while ($iirelation = ingres_fetch_object($rs)) {
echo "\t<tr>\n";
echo "\t\t<td>" . $iirelation->relid . "</td>\n";
echo "\t\t<td>" . $iirelation->relowner . "</td>\n";
echo "\t</tr>\n";
}
echo "</table>\n";
// Commit transaction
ingres_commit($link);
// Closing connection
ingres_close($link);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 74.92.244.246
----
Manual Page -- http://www.php.net/manual/en/ref.ingres.php
Edit -- https://master.php.net/note/edit/73225
Del: integrated -- https://master.php.net/note/delete/73225/integrated
Del: useless -- https://master.php.net/note/delete/73225/useless
Del: bad code -- https://master.php.net/note/delete/73225/bad+code
Del: spam -- https://master.php.net/note/delete/73225/spam
Del: non-english -- https://master.php.net/note/delete/73225/non-english
Del: in docs -- https://master.php.net/note/delete/73225/in+docs
Del: other reasons-- https://master.php.net/note/delete/73225
Reject -- https://master.php.net/note/reject/73225
Search -- https://master.php.net/manage/user-notes.php