betz            Mon Dec 10 16:33:53 2001 EDT

  Modified files:              
    /phpdoc/en/functions        mysql.xml 
  Log:
  adding some php.ini related stuff in partintro.
  cleaning up the examples. some ws fixes.
  
Index: phpdoc/en/functions/mysql.xml
diff -u phpdoc/en/functions/mysql.xml:1.77 phpdoc/en/functions/mysql.xml:1.78
--- phpdoc/en/functions/mysql.xml:1.77  Thu Dec  6 20:55:20 2001
+++ phpdoc/en/functions/mysql.xml       Mon Dec 10 16:33:51 2001
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.77 $ -->
+<!-- $Revision: 1.78 $ -->
  <reference id="ref.mysql">
   <title>MySQL Functions</title>
   <titleabbrev>MySQL</titleabbrev>
@@ -26,6 +26,60 @@
     Documentation for MySQL can be found at <ulink
     url="&url.mysql.docs;">&url.mysql.docs;</ulink>.
    </simpara>
+    <para>
+    The behaviour of the MySQL functions is affected by settings in the global 
+    <link linkend="configuration">configuration</link> file.
+    <table>
+     <title><link linkend="ini.sect.mysql">MySQL Configuration </link> Options</title>
+     <tgroup cols="3">
+      <thead>
+       <row>
+        <entry>Name</entry>
+        <entry>Default</entry>
+        <entry>Changeable</entry>
+       </row>
+      </thead>
+      <tbody>
+       <row>
+        <entry>mysql.allow_persistent</entry>
+        <entry>"On"</entry>
+        <entry>PHP_INI_SYSTEM</entry>
+       </row>
+       <row>
+        <entry>mysql.max_persistent</entry>
+        <entry>"-1"</entry>
+        <entry>PHP_INI_SYSTEM</entry>
+       </row>
+       <row>
+        <entry>mysql.max_links</entry>
+        <entry>"-1"</entry>
+        <entry>PHP_INI_SYSTEM</entry>
+       </row>
+       <row>
+        <entry>mysql.default_port</entry>
+        <entry>NULL</entry>
+        <entry>PHP_INI_ALL</entry>
+       </row>
+       <row>
+        <entry>mysql.default_socket</entry>
+        <entry>NULL</entry>
+        <entry>PHP_INI_ALL</entry>
+       </row>
+       <row>
+        <entry>mysql.default_host</entry>
+        <entry>NULL</entry>
+        <entry>PHP_INI_ALL</entry>
+       </row>
+       <row>
+        <entry>mysql.default_user</entry>
+        <entry>NULL</entry>
+        <entry>PHP_INI_ALL</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    For further details and definition of the PHP_INI_* constants see 
+<function>ini_set</function>.
+   </para>
    <para>
     This simple example shows how to connect, execute a query, print
     resulting rows and disconnect from a MySQL database.
@@ -217,10 +271,10 @@
      <programlisting role="php">
 <![CDATA[
 <?php
-    $link = mysql_connect ("kraemer", "marliesle", "secret")
-        or die ("Could not connect");
+    $link = mysql_connect("kraemer", "marliesle", "secret")
+        or exit("Could not connect");
     print ("Connected successfully");
-    mysql_close ($link);
+    mysql_close($link);
 ?>
 ]]>
      </programlisting>
@@ -304,10 +358,10 @@
      <programlisting role="php">
 <![CDATA[
 <?php
-    $link = mysql_connect ("localhost", "username", "secret")
-        or die ("Could not connect");
+    $link = mysql_connect("localhost", "username", "secret")
+        or die("Could not connect");
     print ("Connected successfully");
-    mysql_close ($link);
+    mysql_close($link);
 ?>
 ]]>
      </programlisting>
@@ -350,9 +404,9 @@
      <programlisting role="php">
 <![CDATA[
 <?php
-    $link = mysql_pconnect ("kron", "jutta", "geheim")
-        or die ("Could not connect");
-    if (mysql_create_db ("my_db")) {
+    $link = mysql_pconnect("kron", "jutta", "geheim")
+        or exit("Could not connect");
+    if (mysql_create_db("my_db")) {
         print ("Database created successfully\n");
     } else {
         printf ("Error creating database: %s\n", mysql_error ());
@@ -386,7 +440,7 @@
      </funcprototype>
     </funcsynopsis>
     <para>
-     &return.success; 
+     &return.success;
     </para>
     <para> 
      <function>mysql_data_seek</function> moves the internal row
@@ -402,31 +456,31 @@
      <programlisting role="php">
 <![CDATA[
 &<?php
-    $link = mysql_pconnect ("kron", "jutta", "geheim")
-        or die ("Could not connect");
+    $link = mysql_pconnect("kron", "jutta", "geheim")
+        or die("Could not connect");
 
-    mysql_select_db ("samp_db")
-        or die ("Could not select database");
+    mysql_select_db("samp_db")
+        or exit("Could not select database");
 
     $query = "SELECT last_name, first_name FROM friends";
-    $result = mysql_query ($query)
-        or die ("Query failed");
+    $result = mysql_query($query)
+        or die("Query failed");
 
     // fetch rows in reverse order
 
-    for ($i = mysql_num_rows ($result) - 1; $i >=0; $i--) {
-        if (!mysql_data_seek ($result, $i)) {
+    for ($i = mysql_num_rows($result) - 1; $i >=0; $i--) {
+        if (!mysql_data_seek($result, $i)) {
             echo "Cannot seek to row $i\n";
             continue;
         }
 
-        if(!($row = mysql_fetch_object ($result)))
+        if(!($row = mysql_fetch_object($result)))
             continue;
 
         echo "$row->last_name $row->first_name<br />\n";
     }
 
-    mysql_free_result ($result);
+    mysql_free_result($result);
 ?>
 ]]>
      </programlisting>
@@ -786,15 +840,16 @@
      <programlisting role="php">
 <![CDATA[
 <?php 
-mysql_connect ($host, $user, $password);
-$result = mysql_db_query ("database","select user_id, fullname from table");
-while ($row = mysql_fetch_array ($result)) {
+mysql_connect($host, $user, $password);
+mysql_select_db("database");
+$result = mysql_query("select user_id, fullname from table");
+while ($row = mysql_fetch_array($result)) {
     echo "user_id: ".$row["user_id"]."<br>\n";
     echo "user_id: ".$row[0]."<br>\n";
     echo "fullname: ".$row["fullname"]."<br>\n";
     echo "fullname: ".$row[1]."<br>\n";
 }
-mysql_free_result ($result);
+mysql_free_result($result);
 ?>
 ]]>
      </programlisting>
@@ -854,13 +909,15 @@
      <programlisting role="php">
 <![CDATA[
 <?php 
-mysql_connect ($host, $user, $password);
-$result = mysql_db_query ("database","select * from table");
-while ($row = mysql_fetch_assoc ($result)) {
+mysql_connect($host, $user, $password);
+mysql_select_db($database);
+$query = "select * from table";
+$result = mysql_query($query);
+while ($row = mysql_fetch_assoc($result)) {
     echo $row["user_id"];
     echo $row["fullname"];
 }
-mysql_free_result ($result);
+mysql_free_result($result);
 ?>
 ]]>
      </programlisting>
@@ -967,15 +1024,16 @@
      <programlisting role="php">
 <![CDATA[
 <?php 
-mysql_connect ($host, $user, $password)
+mysql_connect('localhost:3306', $user, $password)
     or die ("Could not connect");
-$result = mysql_db_query ("database", "select * from table")
-    or die ("Query failed");
+mysql_select_db("database");
+$result = mysql_query("select * from table")
+    or die("Query failed");
 # get column metadata
 $i = 0;
-while ($i < mysql_num_fields ($result)) {
+while ($i < mysql_num_fields($result)) {
     echo "Information for column $i:<BR>\n";
-    $meta = mysql_fetch_field ($result);
+    $meta = mysql_fetch_field($result);
     if (!$meta) {
         echo "No information available<BR>\n";
     }
@@ -995,7 +1053,7 @@
 </PRE>";
     $i++;
 }
-mysql_free_result ($result);
+mysql_free_result($result);
 ?>
 ]]>
      </programlisting>
@@ -1086,13 +1144,14 @@
       <programlisting role="php">
 <![CDATA[
 <?php 
-mysql_connect ($host, $user, $password);
-$result = mysql_db_query ("database", "select * from table");
-while ($row = mysql_fetch_object ($result)) {
+mysql_connect("hostname", "user", $password");
+mysql_select_db($db);
+$result = mysql_query("select * from table");
+while ($row = mysql_fetch_object($result)) {
     echo $row->user_id;
     echo $row->fullname;
 }
-mysql_free_result ($result);
+mysql_free_result($result);
 ?>
 ]]>
       </programlisting>
@@ -1217,8 +1276,10 @@
 //   user_id
 //   username
 //   password.
-
-$res = mysql_db_query("users", "select * from users", $link);
+$link = mysql_connect('localhost', $user, "secret");
+mysql_select_db($dbname, $link)
+    or die("Could not set $dbname");
+$res = mysql_query("select * from users", $link);
 
 echo mysql_field_name($res, 0) . "\n";
 echo mysql_field_name($res, 2);
@@ -1353,20 +1414,20 @@
 <![CDATA[
 <?php 
 
-mysql_connect ("localhost:3306");
-mysql_select_db ("wisconsin");
-$result = mysql_query ("SELECT * FROM onek");
-$fields = mysql_num_fields ($result);
-$rows   = mysql_num_rows ($result);
+mysql_connect("localhost:3306");
+mysql_select_db("wisconsin");
+$result = mysql_query("SELECT * FROM onek");
+$fields = mysql_num_fields($result);
+$rows   = mysql_num_rows($result);
 $i = 0;
-$table = mysql_field_table ($result, $i);
+$table = mysql_field_table($result, $i);
 echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>";
 echo "The table has the following fields <BR>"; 
 while ($i < $fields) {
-    $type  = mysql_field_type  ($result, $i);
-    $name  = mysql_field_name  ($result, $i);
-    $len   = mysql_field_len   ($result, $i);
-    $flags = mysql_field_flags ($result, $i);
+    $type  = mysql_field_type($result, $i);
+    $name  = mysql_field_name($result, $i);
+    $len   = mysql_field_len($result, $i);
+    $flags = mysql_field_flags($result, $i);
     echo $type." ".$name." ".$len." ".$flags."<BR>";
     $i++;
 }
@@ -1864,8 +1925,8 @@
       <programlisting role="php">
 <![CDATA[
 <php
-$result = mysql_query ("SELECT * WHERE 1=1")
-    or die ("Invalid query");
+$result = mysql_query("SELECT * WHERE 1=1")
+    or die("Invalid query");
 ?>
 ]]>
       </programlisting>
@@ -1881,8 +1942,8 @@
       <programlisting role="php">
 <![CDATA[
 <?php
-$result = mysql_query ("SELECT my_col FROM my_tbl")
-    or die ("Invalid query");
+$result = mysql_query("SELECT my_col FROM my_tbl")
+    or exit ("Invalid query");
 ?>
 ]]>
       </programlisting>
@@ -1914,7 +1975,6 @@
     <para>
      See also: <function>mysql_num_rows</function>
      <function>mysql_affected_rows</function>,
-     <function>mysql_db_query</function>,
      <function>mysql_unbuffered_query</function>,
      <function>mysql_free_result</function>,
      <function>mysql_fetch_array</function>,
@@ -2094,11 +2154,11 @@
       <programlisting role="php">
 <![CDATA[
 <?php 
-mysql_connect ("localhost:3306");
-$result = mysql_list_tables ("wisconsin");
+mysql_connect("host");
+$result = mysql_list_tables("wisconsin");
 $i = 0;
-while ($i < mysql_num_rows ($result)) {
-    $tb_names[$i] = mysql_tablename ($result, $i);
+while ($i < mysql_num_rows($result)) {
+    $tb_names[$i] = mysql_tablename($result, $i);
     echo $tb_names[$i] . "<BR>";
     $i++;
 }


Reply via email to