php-doc-en/reference/ingres-ii/examples.xml
Hannes Magnusson 12612a6fad MFB: Upgrade to the new-reference-structure
- (Created missing setup sections in setup.xml, if any)
 - Moved the intro to book.xml
 - Changed the intro ID from <extname>.intro to intro.<extname>
 - Moved the constants entity to book.xml
 - Changed constants.xml to be an appendix
 - Moved the examples into its own chapter (examples.xml)
	NOTE: The "ingres.examples" ID was renamed to ingres.examples-basic and the example chapter uses the 'ingres.examples' ID now
 - Moved the requirements and resources sections to setup.xml
 - Moved the configure entity to setup.xml


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@248841 c90b9560-bf6c-de11-be94-00142212c4b1
2007-12-23 18:42:15 +00:00

69 lines
1.7 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<chapter xml:id="ingres.examples" xmlns="http://docbook.org/ns/docbook">
&reftitle.examples;
<section xml:id="ingres.examples-basic">
<para>
This simple example shows how to connect, execute a query, print
resulting rows and disconnect from an Ingres database.
<example>
<title>Simple Ingres Example</title>
<programlisting role="php">
<![CDATA[
<?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';
$returncode = 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(INGRES_BOTH, $link)) {
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);
?>
]]>
</programlisting>
</example>
</para>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->