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
$link = ingres_connect('database', 'user', 'password')
or die('Could not connect: ' . ingres_error($link));
echo 'Connected successfully';
$query = 'SELECT * FROM iirelation';
$rs = ingres_query($link,$query) or die('Query failed: ' .
ingres_error($link));
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";
ingres_commit($link);
ingres_close($link);
?>