mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
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:
parent
a0289e8040
commit
8ad868325a
1 changed files with 42 additions and 6 deletions
|
@ -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">
|
||||
<?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">
|
||||
<?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:<BR>\n";
|
||||
$meta = mysql_fetch_field ($result);
|
||||
if (!$meta) {
|
||||
echo "No information available<BR>\n";
|
||||
}
|
||||
echo "<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
|
||||
</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>
|
||||
|
|
Loading…
Reference in a new issue