Added a example for mysql_fetch_field(). Not tested but jade is still happy.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@26014 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Egon Schmid 2000-06-10 17:36:51 +00:00
parent a0289e8040
commit 8ad868325a

View file

@ -533,16 +533,16 @@ select t1.f1 as foo t2.f1 as bar from t1, t2
<function>mysql_fetch_row</function>.
</para>
<example>
<title>mysql fetch array</title>
<title><function>Mysql_fetch_array</function></title>
<programlisting role="php">
&lt;?php
mysql_connect($host,$user,$password);
$result = mysql_db_query("database","select * from table");
while($row = mysql_fetch_array($result)) {
mysql_connect ($host, $user, $password);
$result = mysql_db_query ("database","select * from table");
while ($row = mysql_fetch_array ($result)) {
echo $row["user_id"];
echo $row["fullname"];
}
mysql_free_result($result);
mysql_free_result ($result);
?>
</programlisting>
</example>
@ -641,8 +641,44 @@ mysql_free_result($result);
</listitem>
</itemizedlist>
</para>
<example>
<title><function>Mysql_fetch_field</function></title>
<programlisting role="php">
&lt;?php
mysql_connect ($host, $user, $password)
or die ("Could not connect");
$result = mysql_db_query ("database", "select * from table")
or die ("Query failed");
# get column metadata
$i = 0;
while ($i $lt; mysql_num_fields ($result)) {
echo "Information for column $i:&lt;BR>\n";
$meta = mysql_fetch_field ($result);
if (!$meta) {
echo "No information available&lt;BR>\n";
}
echo "&lt;PRE>
blob: $meta -> blob
max_length: $meta -> max_length
multiple_key: $meta -> multiple_key
name: $meta -> name
not_null: $meta -> not_null
numeric: $meta -> numeric
primary_key: $meta -> primary_key
table: $meta -> table
type: $meta -> type
unique_key: $meta -> unique_key
unsigned: $meta -> unsigned
zerofill: $meta -> zerofill
&lt;/PRE>";
$i++;
}
mysql_free_result ($result);
?>
</programlisting>
</example>
<para>
See also <function>mysql_field_seek</function>
See also <function>mysql_field_seek</function>.
</para>
</refsect1>
</refentry>