PHP Doku:: Ingres-Funktionen - ref.ingres.html

Verlauf / Chronik / History: (6) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenIngres DBMS, EDBC und Enterprise Access GatewaysIngres-Funktionen

Ein Service von Reinhard Neidl - Webprogrammierung.

Ingres DBMS, EDBC und Enterprise Access Gateways

<<Einfaches Beispiel mit Ingres

ingres_autocommit_state>>


UnterSeiten:

Ingres-Funktionen

Inhaltsverzeichnis


2 BenutzerBeiträge:
- Beiträge aktualisieren...
corysbrain-ondrugs at yahoo dot com
7.07.2007 18:04
My post below works but is *not* the correct way.  It only works because of default behavior.   I'll re-post my understanding of what is "correct" soon.
corysbrain-ondrugs at yahoo dot com
14.02.2007 3:57
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($link,$query) 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);
?>



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)