- Fix examples in MySQL

- Fix parameters types and reorder sections in uodbc


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@75190 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2002-03-25 20:26:03 +00:00
parent 8ab5fcbe11
commit e52a60666c
2 changed files with 282 additions and 238 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.100 $ -->
<!-- $Revision: 1.101 $ -->
<reference id="ref.mysql">
<title>MySQL Functions</title>
<titleabbrev>MySQL</titleabbrev>
@ -159,38 +159,36 @@
<example>
<title>MySQL extension overview example</title>
<programlisting role="php">
<![CDATA[
<?php
// Connecting, selecting database
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
or die("Could not connect");
print "Connected successfully";
mysql_select_db("my_database")
or die("Could not select database");
<![CDATA[
<?php
/* Connecting, selecting database */
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
or die("Could not connect");
print "Connected successfully";
mysql_select_db("my_database") or die("Could not select database");
// Performing SQL query
$query = "SELECT * FROM my_table";
$result = mysql_query($query)
or die("Query failed");
/* Performing SQL query */
$query = "SELECT * FROM my_table";
$result = mysql_query($query) or die("Query failed");
// Printing results in HTML
print "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
/* Printing results in HTML */
print "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
// Free resultset
mysql_free_result($result);
/* Free resultset */
mysql_free_result($result);
// Closing connection
mysql_close($link);
?>
]]>
/* Closing connection */
mysql_close($link);
?>
]]>
</programlisting>
</example>
</para>
@ -316,7 +314,7 @@
$link = mysql_connect('localhost', 'myname', 'secret');
$charset = mysql_character_set_name($link);
printf ("current character set is %s\n", $charset);
?>
]]>
</programlisting>
<para>
@ -510,6 +508,7 @@ latin1
<?php
$link = mysql_pconnect("kron", "jutta", "geheim")
or exit("Could not connect");
if (mysql_create_db("my_db")) {
print ("Database created successfully\n");
} else {
@ -568,9 +567,8 @@ latin1
$result = mysql_query($query)
or die("Query failed");
// fetch rows in reverse order
for ($i = mysql_num_rows($result) - 1; $i >=0; $i--) {
/* fetch rows in reverse order */
for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
if (!mysql_data_seek($result, $i)) {
echo "Cannot seek to row $i\n";
continue;
@ -623,17 +621,17 @@ latin1
<programlisting role="php">
<![CDATA[
<?php
error_reporting(E_ALL);
error_reporting(E_ALL);
mysql_connect('dbhost', 'username', 'password');
$db_list = mysql_list_dbs();
mysql_connect('dbhost', 'username', 'password');
$db_list = mysql_list_dbs();
$i = 0;
$cnt = mysql_num_rows($db_list);
while ($i < $cnt) {
echo mysql_db_name($db_list, $i) . "\n";
$i++;
}
$i = 0;
$cnt = mysql_num_rows($db_list);
while ($i < $cnt) {
echo mysql_db_name($db_list, $i) . "\n";
$i++;
}
?>
]]>
</programlisting>
@ -753,12 +751,12 @@ while ($i < $cnt) {
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("marliesle");
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."<BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_connect("kossu");
echo mysql_errno().": ".mysql_error()."<br />";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."<br />";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."<br />";
?>
]]>
</programlisting>
@ -802,12 +800,12 @@ echo mysql_errno().": ".mysql_error()."<BR>";
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("marliesle");
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."<BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_connect("marliesle");
echo mysql_errno().": ".mysql_error()."<br />";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."<br />";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."<br />";
?>
]]>
</programlisting>
@ -852,21 +850,21 @@ echo mysql_errno().": ".mysql_error()."<BR>";
<example>
<title><function>mysql_real_escape_string</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$item = "Zak's Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
}
]]>
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$item = "Zak's Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
Escaped string: Zak\'s Laptop
]]>
<![CDATA[
Escaped string: Zak\'s Laptop
]]>
</screen>
</para>
</example>
@ -948,16 +946,16 @@ select tone.field as foo ttwo.field as bar from tone, ttwo
<programlisting role="php">
<![CDATA[
<?php
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_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);
?>
]]>
</programlisting>
@ -1015,15 +1013,15 @@ mysql_free_result($result);
<programlisting role="php">
<![CDATA[
<?php
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_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);
?>
]]>
</programlisting>
@ -1131,7 +1129,7 @@ mysql_connect('localhost:3306', $user, $password)
mysql_select_db("database");
$result = mysql_query("select * from table")
or die("Query failed");
# get column metadata
/* get column metadata */
$i = 0;
while ($i < mysql_num_fields($result)) {
echo "Information for column $i:<BR>\n";
@ -1139,7 +1137,7 @@ while ($i < mysql_num_fields($result)) {
if (!$meta) {
echo "No information available<BR>\n";
}
echo "<PRE>
echo "<pre>
blob: $meta->blob
max_length: $meta->max_length
multiple_key: $meta->multiple_key
@ -1152,7 +1150,7 @@ type: $meta->type
unique_key: $meta->unique_key
unsigned: $meta->unsigned
zerofill: $meta->zerofill
</PRE>";
</pre>";
$i++;
}
mysql_free_result($result);
@ -1225,9 +1223,9 @@ mysql_free_result($result);
<![CDATA[
<?php
// this is valid
/* this is valid */
echo $row->field;
// this is invalid
/* this is invalid */
echo $row->0;
?>
@ -1366,10 +1364,11 @@ mysql_free_result($result);
<title><function>mysql_field_name</function> example</title>
<programlisting role="php">
<![CDATA[
// The users table consists of three fields:
// user_id
// username
// password.
/* The users table consists of three fields:
* user_id
* username
* password.
*/
$link = mysql_connect('localhost', $user, "secret");
mysql_select_db($dbname, $link)
or die("Could not set $dbname");
@ -1499,7 +1498,6 @@ password
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost:3306");
mysql_select_db("wisconsin");
$result = mysql_query("SELECT * FROM onek");
@ -1507,14 +1505,14 @@ $fields = mysql_num_fields($result);
$rows = mysql_num_rows($result);
$i = 0;
$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>";
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);
echo $type." ".$name." ".$len." ".$flags."<BR>";
echo $type." ".$name." ".$len." ".$flags."<br />";
$i++;
}
mysql_close();
@ -1716,7 +1714,7 @@ $fields = mysql_list_fields("database1", "table1", $link);
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
echo mysql_field_name($fields, $i) . "\n";;
echo mysql_field_name($fields, $i) . "\n";
}
]]>
</programlisting>
@ -1775,7 +1773,7 @@ while ($row = mysql_fetch_row($result)){
$row["Command"], $row["Time"]);
}
mysql_free_result ($result);
?>
]]>
</programlisting>
<para>
@ -2078,7 +2076,7 @@ $result = mysql_query("SELECT * WHERE 1=1")
<![CDATA[
<?php
$result = mysql_query("SELECT my_col FROM my_tbl")
or exit ("Invalid query");
or die ("Invalid query");
?>
]]>
</programlisting>
@ -2199,17 +2197,17 @@ $result = mysql_query("SELECT my_col FROM my_tbl")
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$item = "Zak's Laptop";
$item = "Zak's and Derick's Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
}
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
Escaped string: Zak\'s Laptop
Escaped string: Zak\'s and Derick\'s Laptop
]]>
</screen>
</para>
@ -2332,10 +2330,10 @@ Escaped string: Zak\'s Laptop
<![CDATA[
<?php
mysql_connect("host");
$result = mysql_list_tables("wisconsin");
$result = mysql_list_tables("kossu");
for ($i = 0; $i < mysql_num_rows($result); $i++) {
$tb_names[$i] = mysql_tablename($result, $i);
echo $tb_names[$i] . "<BR>";
echo $tb_names[$i] . "<br />";
}
?>
]]>
@ -2367,8 +2365,9 @@ for ($i = 0; $i < mysql_num_rows($result); $i++) {
$link = mysql_connect('localhost', 'myname', 'secret');
$thread_id = mysql_thread_id($link);
if ($thread_id){
printf ("current thread id is %d\n", $thread_id);
printf ("current thread id is %d\n", $thread_id);
}
?>
]]>
</programlisting>
<para>
@ -2508,8 +2507,10 @@ current thread_id is 73
<title><function>mysql_stat</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', $user, "secret");
printf("%s\n", mysql_stat($link));
?>
]]>
</programlisting>
<para>

View file

@ -1,35 +1,19 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.33 $ -->
<!-- $Revision: 1.34 $ -->
<reference id="ref.odbc">
<title>Unified ODBC functions</title>
<titleabbrev>ODBC</titleabbrev>
<partintro>
<simpara>
<para id="odbc.intro">
In addition to normal ODBC support, the Unified ODBC functions in
PHP allow you to access several databases that have borrowed the
semantics of the ODBC API to implement their own API. Instead of
maintaining multiple database drivers that were all nearly
identical, these drivers have been unified into a single set of
ODBC functions.
</simpara>
<simpara>
The following databases are supported by the Unified ODBC
functions: <ulink url="&url.adabas;">Adabas D</ulink>, <ulink
url="&url.ibmdb2;">IBM DB2</ulink>, <ulink
url="&url.iodbc;">iODBC</ulink>, <ulink
url="&url.solid;">Solid</ulink>, and <ulink
url="&url.sybase;">Sybase SQL Anywhere</ulink>.
</simpara>
<!-- install.xml has changed, so this link is no longer working
<simpara>
Please see the <link
linkend="database-support-options">Installation on Unix
Systems</link> chapter for more information about configuring PHP
with these databases.
</simpara>
-->
</para>
<note>
<simpara>
<para>
There is no ODBC involved when connecting to the above
databases. The functions that you use to speak natively to them
just happen to share the same names and syntax as the ODBC
@ -38,8 +22,49 @@
applications. iODBC is maintained by <ulink url="&url.openlink;">
OpenLink Software</ulink>. More information on iODBC, as well as a
HOWTO, is available at <ulink url="&url.iodbc;">www.iodbc.org</ulink>.
</simpara>
</para>
</note>
<section id="odbc.requirements">
<para>
The following databases are supported by the Unified ODBC
functions: <ulink url="&url.adabas;">Adabas D</ulink>, <ulink
url="&url.ibmdb2;">IBM DB2</ulink>, <ulink
url="&url.iodbc;">iODBC</ulink>, <ulink
url="&url.solid;">Solid</ulink>, and <ulink
url="&url.sybase;">Sybase SQL Anywhere</ulink>.
</para>
</section>
<section id="odbc.installation">
<para>
Please see the <link
linkend="database-support-options">Installation on Unix
Systems</link> chapter for more information about configuring PHP
with these databases.
</para>
</section>
<section id="odbc.configuration">
<title>Runtime Configuration</title>
<para>
This extension does not define any configuration directives.
</para>
</section>
<section id="odbc.resources">
<title>Resource types</title>
<para>
This extension does not define any resource types.
</para>
</section>
<section id="odbc.constants">
<title>Predefined constants</title>
<para>
This extension does not define any constants.
</para>
</section>
</partintro>
<refentry id="function.odbc-autocommit">
@ -50,9 +75,9 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_autocommit</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>OnOff</parameter></methodparam>
<type>bool</type><methodname>odbc_autocommit</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>OnOff</parameter></methodparam>
</methodsynopsis>
<para>
Without the <parameter>OnOff</parameter> parameter, this function
@ -87,7 +112,7 @@
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_binmode</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
@ -195,7 +220,7 @@
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>odbc_close</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
</methodsynopsis>
<para>
<function>odbc_close</function> will close down the connection to
@ -243,8 +268,8 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_commit</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>bool</type><methodname>odbc_commit</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
</methodsynopsis>
<para>
Returns: &true; on success,
@ -262,7 +287,7 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_connect</methodname>
<type>resource</type><methodname>odbc_connect</methodname>
<methodparam><type>string</type><parameter>dsn</parameter></methodparam>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
@ -330,7 +355,7 @@
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_cursor</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
odbc_cursor will return a cursorname for the given result_id.
@ -346,8 +371,8 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_do</methodname>
<methodparam><type>int</type><parameter>conn_id</parameter></methodparam>
<type>resource</type><methodname>odbc_do</methodname>
<methodparam><type>resource</type><parameter>conn_id</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
@ -366,7 +391,7 @@
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_error</methodname>
<methodparam choice="opt"><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>connection_id</parameter></methodparam>
</methodsynopsis>
<simpara>
Returns a six-digit ODBC state, or an empty string if there
@ -390,7 +415,7 @@
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_errormsg</methodname>
<methodparam choice="opt"><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>connection_id</parameter></methodparam>
</methodsynopsis>
<simpara>
Returns a string containing the last ODBC error message, or an empty
@ -414,8 +439,8 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_exec</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_exec</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>string</type><parameter>query_string</parameter></methodparam>
</methodsynopsis>
<para>
@ -445,8 +470,8 @@
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_execute</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<type>resource</type><methodname>odbc_execute</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>parameters_array</parameter></methodparam>
</methodsynopsis>
<para>
@ -509,12 +534,18 @@
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_fetch_into</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>rownumber</parameter></methodparam>
<methodparam><type>array</type><parameter>result_array</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>bool</type><methodname>odbc_fetch_into</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>rownumber</parameter></methodparam>
<methodparam><type>array</type><parameter>result_array</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>resource</type><methodname>odbc_fetch_into</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>array</type><parameter>result_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>rownumber</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of columns in the result;
&false; on error.
@ -523,14 +554,28 @@
array. The array will contain the column values starting at array
index 0.
</para>
<para>
<example>
<title><function>odbc_fetch_into</function> pre 4.0.6 example </title>
<programlisting role="php">
<para>
As of PHP 4.0.5 the <parameter>result_array</parameter> does not
need to be passed by reference any longer.
</para>
<para>
As of PHP 4.0.6 the <parameter>rownumber</parameter> cannot be
passed as a constant, but rather as a variable.
</para>
<para>
As of PHP 4.2.0 the <parameter>result_array</parameter> and
<parameter>rownumber</parameter> have been swapped. This allows the
rownumber to be a constant again. This change will also be the last one
to this function.
</para>
<para>
<example>
<title><function>odbc_fetch_into</function> pre 4.0.6 example </title>
<programlisting role="php">
<![CDATA[
$rc = odbc_fetch_into($res_id, $my_array);
]]>
</programlisting>
</programlisting>
<para>
or
</para>
@ -540,50 +585,48 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
$rc = odbc_fetch_into($res_id, 1, $my_array);
]]>
</programlisting>
</example>
</para>
<para>
As of PHP 4.0.5 the <parameter>result_array</parameter> does not
need to be passed by reference any longer.
</para>
<para>
As of PHP 4.0.6 the <parameter>rownumber</parameter> cannot be
passed as a constant, but rather as a variable.
</para>
<para>
<example>
<title><function>odbc_fetch_into</function> 4.0.6 example</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
<example>
<title><function>odbc_fetch_into</function> 4.0.6 example</title>
<programlisting role="php">
<![CDATA[
$rc = odbc_fetch_into($res_id, $my_array);
]]>
</programlisting>
<para>
or
</para>
<programlisting role="php">
</programlisting>
<para>
or
</para>
<programlisting role="php">
<![CDATA[
$row = 1;
$rc = odbc_fetch_into($res_id, $row, $my_array);
]]>
</programlisting>
</example>
</para>
<para>
Future: In PHP 4.1, this function will be moved to the following
format:
<methodsynopsis>
<type>int</type><methodname>odbc_fetch_into</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>array</type><parameter>result_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>rownumber</parameter></methodparam>
</methodsynopsis>
Please note, that <parameter>rownumber</parameter> will be optional,
while <parameter>result_array</parameter> is not.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>odbc_fetch_into</function> 4.2.0 example</title>
<programlisting role="php">
<![CDATA[
$rc = odbc_fetch_into($res_id, $my_array);
]]>
</programlisting>
<para>
or
</para>
<programlisting role="php">
<![CDATA[
$rc = odbc_fetch_into($res_id,$my_array, 2);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.odbc-fetch-row">
<refnamediv>
@ -593,8 +636,8 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_fetch_row</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<type>bool</type><methodname>odbc_fetch_row</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row_number</parameter></methodparam>
</methodsynopsis>
<para>
@ -639,7 +682,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>odbc_fetch_array</methodname>
<methodparam><type>int</type><parameter>result</parameter></methodparam>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>rownumber</parameter></methodparam>
</methodsynopsis>
<para>
@ -659,7 +702,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>odbc_next_result</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
@ -678,7 +721,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>odbc_fetch_object</methodname>
<methodparam><type>int</type><parameter>result</parameter></methodparam>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>rownumber</parameter></methodparam>
</methodsynopsis>
<para>
@ -696,7 +739,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_field_name</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
@ -717,7 +760,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_field_num</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>string</type><parameter>field_name</parameter></methodparam>
</methodsynopsis>
<para>
@ -738,7 +781,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_field_type</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
@ -758,7 +801,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_field_len</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
@ -782,7 +825,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_field_precision</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
@ -806,7 +849,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_field_scale</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
@ -825,8 +868,8 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_free_result</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<type>bool</type><methodname>odbc_free_result</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
Always returns &true;.
@ -860,11 +903,11 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<methodsynopsis>
<type>int</type><methodname>odbc_longreadlen</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>length</parameter></methodparam>
</methodsynopsis>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>int</type><parameter>length</parameter></methodparam>
</methodsynopsis>
<para>
(ODBC SQL types affected: LONG, LONGVARBINARY) The number of
bytes returned to PHP is controled by the parameter length. If it
@ -887,10 +930,10 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_num_fields</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>int</type><methodname>odbc_num_fields</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
<function>odbc_num_fields</function> will return the number of
fields (columns) in an ODBC result. This function will return -1
@ -949,8 +992,8 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_prepare</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_prepare</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>string</type><parameter>query_string</parameter></methodparam>
</methodsynopsis>
<para>
@ -973,7 +1016,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_num_rows</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
<function>odbc_num_rows</function> will return the number of rows
@ -1000,7 +1043,7 @@ $rc = odbc_fetch_into($res_id, $row, $my_array);
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>odbc_result</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
@ -1060,7 +1103,7 @@ longer than 4096 bytes, the contents is not
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_result_all</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>format</parameter></methodparam>
</methodsynopsis>
<para>
@ -1086,7 +1129,7 @@ longer than 4096 bytes, the contents is not
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_rollback</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
</methodsynopsis>
<para>
Rolls back all pending statements on
@ -1109,7 +1152,7 @@ longer than 4096 bytes, the contents is not
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_setoption</methodname>
<methodparam><type>int</type><parameter>id</parameter></methodparam>
<methodparam><type>resource</type><parameter>id</parameter></methodparam>
<methodparam><type>int</type><parameter>function</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
<methodparam><type>int</type><parameter>param</parameter></methodparam>
@ -1135,7 +1178,7 @@ longer than 4096 bytes, the contents is not
matters.
</para>
<para>
<parameter>ID</parameter> is a connection id or result id on
<parameter>id</parameter> is a connection id or result id on
which to change the settings.For SQLSetConnectOption(), this is a
connection id. For SQLSetStmtOption(), this is a result
id.
@ -1187,7 +1230,7 @@ odbc_execute ($result);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_tables</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>owner</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
@ -1282,7 +1325,7 @@ odbc_execute ($result);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_tableprivileges</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>owner</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
@ -1328,7 +1371,7 @@ odbc_execute ($result);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_columns</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>owner</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>table_name</parameter></methodparam>
@ -1385,7 +1428,7 @@ odbc_execute ($result);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_columnprivileges</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>owner</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>table_name</parameter></methodparam>
@ -1432,7 +1475,7 @@ odbc_execute ($result);
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_gettypeinfo</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>data_type</parameter></methodparam>
</methodsynopsis>
<para>
@ -1478,8 +1521,8 @@ odbc_execute ($result);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_primarykeys</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_primarykeys</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam><type>string</type><parameter>owner</parameter></methodparam>
<methodparam><type>string</type><parameter>table</parameter></methodparam>
@ -1515,8 +1558,8 @@ odbc_execute ($result);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_foreignkeys</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_foreignkeys</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>string</type><parameter>pk_qualifier</parameter></methodparam>
<methodparam><type>string</type><parameter>pk_owner</parameter></methodparam>
<methodparam><type>string</type><parameter>pk_table</parameter></methodparam>
@ -1581,8 +1624,8 @@ odbc_execute ($result);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_procedures</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_procedures</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>owner</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
@ -1622,8 +1665,8 @@ odbc_execute ($result);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_procedurecolumns</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_procedurecolumns</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>owner</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>proc</parameter></methodparam>
@ -1676,8 +1719,8 @@ odbc_execute ($result);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_specialcolumns</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_specialcolumns</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>int</type><parameter>type</parameter></methodparam>
<methodparam><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam><type>string</type><parameter>owner</parameter></methodparam>
@ -1728,8 +1771,8 @@ odbc_execute ($result);
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>odbc_statistics</methodname>
<methodparam><type>int</type><parameter>connection_id</parameter></methodparam>
<type>resource</type><methodname>odbc_statistics</methodname>
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
<methodparam><type>string</type><parameter>qualifier</parameter></methodparam>
<methodparam><type>string</type><parameter>owner</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>