cvs: phpdoc /en/reference/msql reference.xml /en/reference/msql/functions msql-connect.xml msql-error.xml

From: Date: Wed, 03 Mar 2004 07:33:38 +0000
Subject: cvs: phpdoc /en/reference/msql reference.xml /en/reference/msql/functions msql-connect.xml msql-error.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969359366@lists.php.net to get a copy of this message
irchtml Wed Mar 3 02:33:38 2004 EDT Modified files: /phpdoc/en/reference/msql reference.xml /phpdoc/en/reference/msql/functions msql-connect.xml msql-error.xml Log: added example; fixed proto http://cvs.php.net/diff.php/phpdoc/en/reference/msql/reference.xml?r1=1.10&r2=1.11&ty=u Index: phpdoc/en/reference/msql/reference.xml diff -u phpdoc/en/reference/msql/reference.xml:1.10 phpdoc/en/reference/msql/reference.xml:1.11 --- phpdoc/en/reference/msql/reference.xml:1.10 Tue Mar 2 20:01:07 2004 +++ phpdoc/en/reference/msql/reference.xml Wed Mar 3 02:33:37 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <reference id="ref.msql"> <title>mSQL Functions</title> <titleabbrev>mSQL</titleabbrev> @@ -29,6 +29,50 @@ &reference.msql.constants; + <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)); + +msql_select_db('database') + or die('Could not select database', $link); + +/* 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> + </partintro> &reference.msql.functions; http://cvs.php.net/diff.php/phpdoc/en/reference/msql/functions/msql-connect.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/msql/functions/msql-connect.xml diff -u phpdoc/en/reference/msql/functions/msql-connect.xml:1.6 phpdoc/en/reference/msql/functions/msql-connect.xml:1.7 --- phpdoc/en/reference/msql/functions/msql-connect.xml:1.6 Tue Mar 2 05:16:06 2004 +++ phpdoc/en/reference/msql/functions/msql-connect.xml Wed Mar 3 02:33:38 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/msql.xml, last change in rev 1.2 --> <refentry id="function.msql-connect"> <refnamediv> @@ -11,13 +11,12 @@ <methodsynopsis> <type>int</type><methodname>msql_connect</methodname> <methodparam choice="opt"><type>string</type><parameter>hostname</parameter></methodparam> - <methodparam choice="opt"><type>string</type><parameter>server</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam> </methodsynopsis> <para> <function>msql_connect</function> establishes a connection to a - mSQL server. The <parameter>server</parameter> parameter can also + mSQL server. The <parameter>hostname</parameter> parameter can also include a port number. e.g. &quot;hostname:port&quot;. It defaults to 'localhost'. </para> http://cvs.php.net/diff.php/phpdoc/en/reference/msql/functions/msql-error.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc/en/reference/msql/functions/msql-error.xml diff -u phpdoc/en/reference/msql/functions/msql-error.xml:1.3 phpdoc/en/reference/msql/functions/msql-error.xml:1.4 --- phpdoc/en/reference/msql/functions/msql-error.xml:1.3 Tue Mar 2 05:16:06 2004 +++ phpdoc/en/reference/msql/functions/msql-error.xml Wed Mar 3 02:33:38 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/msql.xml, last change in rev 1.2 --> <refentry id="function.msql-error"> <refnamediv> @@ -13,9 +13,11 @@ <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> - Errors coming back from the mSQL database backend no longer - issue warnings. Instead, use this functions to retrieve the - error string. + <function>msql_error</function> returns the last issued error by the mSQL + server or an empty string if no error was issued. If no link is + explicitly passed, the last successful open link will be used to retrieve + the error message. Note that only the last error message is accessible + with <function>msql_error</function>. </para> </refsect1> </refentry>

« previous php.doc (#969359366) next »