2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-07-22 13:32:57 +00:00
|
|
|
<!-- $Revision: 1.12 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<reference id="ref.msql">
|
2004-02-24 08:46:39 +00:00
|
|
|
<title>mSQL Functions</title>
|
2002-04-15 00:12:54 +00:00
|
|
|
<titleabbrev>mSQL</titleabbrev>
|
|
|
|
<partintro>
|
2002-07-26 12:08:12 +00:00
|
|
|
|
|
|
|
<section id="msql.intro">
|
|
|
|
&reftitle.intro;
|
|
|
|
<para>
|
|
|
|
These functions allow you to access mSQL database servers. More
|
|
|
|
information about mSQL can be found at
|
|
|
|
<ulink url="&url.msql;">&url.msql;</ulink>.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2002-11-30 15:33:22 +00:00
|
|
|
&reference.msql.configure;
|
2002-07-26 12:08:12 +00:00
|
|
|
|
2002-09-14 21:26:46 +00:00
|
|
|
&reference.msql.ini;
|
2002-07-26 12:08:12 +00:00
|
|
|
|
|
|
|
<section id="msql.resources">
|
|
|
|
&reftitle.resources;
|
|
|
|
<para>
|
2004-03-03 01:01:07 +00:00
|
|
|
There are two resource types used in the mSQL module. The first one
|
|
|
|
is the link identifier for a database connection, the second a resource
|
|
|
|
which holds the result of a query.
|
2002-07-26 12:08:12 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
&reference.msql.constants;
|
|
|
|
|
2004-03-03 07:33:38 +00:00
|
|
|
<section id="msql.examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
This simple example shows how to connect, execute a query, print
|
|
|
|
resulting rows and disconnect from a mSQL database.
|
|
|
|
<example>
|
|
|
|
<title>mSQL usage example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
/* Connecting, selecting database */
|
|
|
|
$link = msql_connect('localhost', 'username', 'password')
|
|
|
|
or die('Could not connect : ' . msql_error($link));
|
|
|
|
|
2004-07-22 13:32:57 +00:00
|
|
|
msql_select_db('database', $link)
|
|
|
|
or die('Could not select database');
|
2004-03-03 07:33:38 +00:00
|
|
|
|
|
|
|
/* Issue SQL query */
|
|
|
|
$query = 'SELECT * FROM my_table';
|
|
|
|
$result = msql_query($query, $link) or die('Query failed : ' . msql_error($link));
|
|
|
|
|
|
|
|
/* Printing results in HTML */
|
|
|
|
echo "<table>\n";
|
|
|
|
while ($row = msql_fetch_array($result, MSQL_ASSOC)) {
|
|
|
|
echo "\t<tr>\n";
|
|
|
|
foreach ($row as $col_value) {
|
|
|
|
echo "\t\t<td>$col_value</td>\n";
|
|
|
|
}
|
|
|
|
echo "\t</tr>\n";
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
/* Free result set */
|
|
|
|
msql_free_result($result);
|
|
|
|
|
|
|
|
/* Close connection */
|
|
|
|
msql_close($link);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2002-04-15 00:12:54 +00:00
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&reference.msql.functions;
|
|
|
|
|
|
|
|
</reference>
|
2002-07-26 12:08:12 +00:00
|
|
|
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- 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
|
|
|
|
-->
|
|
|
|
|