Turned ?> -> ?>

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@48749 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Damien Seguy 2001-05-28 08:37:11 +00:00
parent c7c95d0ebb
commit 077741678f

View file

@ -24,7 +24,40 @@
Documentation for MySQL can be found at <ulink
url="&url.mysql.docs;">&url.mysql.docs;</ulink>.
</simpara>
<para>
This simple example shows how to connect, execute a query, print
resulting rows and disconnect from MySQL Database.
<example>
<title>MySQL extension overview example</title>
<programlisting role="php">
&lt;?php
$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");
$query = "SELECT * FROM my_table";
$result = mysql_query ($query)
or die ("Query failed");
// printing HTML result
print "<table>\n";
while($line = mysql_fetch_array($result, MYSQL_){
print "\t<tr>\n";
while(list($col_name, $col_value) = each($line)){
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
mysql_close($link);
?&gt;
</programlisting>
</example>
</para>
</partintro>
<refentry id="function.mysql-affected-rows">
@ -176,7 +209,7 @@
or die ("Could not connect");
print ("Connected successfully");
mysql_close ($link);
?>
?&gt;
</programlisting>
</example>
<para>
@ -311,7 +344,7 @@
} else {
printf ("Error creating database: %s\n", mysql_error ());
}
?>
?&gt;
</programlisting>
</example>
<para>
@ -380,7 +413,7 @@
}
mysql_free_result ($result);
?>
?&gt;
</programlisting>
</example>
</refsect1>
@ -562,7 +595,7 @@ mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
?>
?&gt;
</programlisting>
</informalexample>
</para>
@ -611,7 +644,7 @@ mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
?>
?&gt;
</programlisting>
</informalexample>
</para>
@ -718,7 +751,7 @@ while ($row = mysql_fetch_array ($result)) {
echo "fullname: ".$row[1]."&lt;br>\n";
}
mysql_free_result ($result);
?>
?&gt;
</programlisting>
</example>
</refsect1>
@ -777,7 +810,7 @@ while ($row = mysql_fetch_assoc ($result)) {
echo $row["fullname"];
}
mysql_free_result ($result);
?>
?&gt;
</programlisting>
</example>
</refsect1>
@ -910,7 +943,7 @@ zerofill: $meta->zerofill
$i++;
}
mysql_free_result ($result);
?>
?&gt;
</programlisting>
</example>
<para>
@ -1003,7 +1036,7 @@ while ($row = mysql_fetch_object ($result)) {
echo $row->fullname;
}
mysql_free_result ($result);
?>
?&gt;
</programlisting>
</example>
</para>
@ -1278,7 +1311,7 @@ while ($i &lt; $fields) {
}
mysql_close();
?>
?&gt;
</programlisting>
</example>
</para>
@ -1749,7 +1782,7 @@ echo "$num_rows Rows\n";
&lt;?php
$result = mysql_query ("SELECT * WHERE 1=1")
or die ("Invalid query");
?>
?&gt;
</programlisting>
</example>
</para>
@ -1764,7 +1797,7 @@ $result = mysql_query ("SELECT * WHERE 1=1")
&lt;?php
$result = mysql_query ("SELECT my_col FROM my_tbl")
or die ("Invalid query");
?>
?&gt;
</programlisting>
</example>
</para>
@ -1972,7 +2005,7 @@ while ($i &lt; mysql_num_rows ($result)) {
echo $tb_names[$i] . "&lt;BR>";
$i++;
}
?>
?&gt;
</programlisting>
</example>
</para>