mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
pearised example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@168366 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
7a22916f9a
commit
2d3ce8d205
1 changed files with 12 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.19 $ -->
|
||||
<!-- $Revision: 1.20 $ -->
|
||||
<reference id="ref.mysql">
|
||||
<title>MySQL Functions</title>
|
||||
<titleabbrev>MySQL</titleabbrev>
|
||||
|
@ -40,7 +40,6 @@
|
|||
</section>
|
||||
|
||||
&reference.mysql.constants;
|
||||
|
||||
|
||||
<section id="mysql.examples">
|
||||
&reftitle.examples;
|
||||
|
@ -52,17 +51,17 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Connecting, selecting database */
|
||||
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
|
||||
or die("Could not connect : " . mysql_error());
|
||||
echo "Connected successfully";
|
||||
mysql_select_db("my_database") or die("Could not select database");
|
||||
// Connecting, selecting database
|
||||
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
|
||||
or die('Could not connect: ' . mysql_error());
|
||||
echo '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 : " . mysql_error());
|
||||
// Performing SQL query
|
||||
$query = 'SELECT * FROM my_table';
|
||||
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
|
||||
|
||||
/* Printing results in HTML */
|
||||
// Printing results in HTML
|
||||
echo "<table>\n";
|
||||
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
echo "\t<tr>\n";
|
||||
|
@ -73,10 +72,10 @@ while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
|||
}
|
||||
echo "</table>\n";
|
||||
|
||||
/* Free resultset */
|
||||
// Free resultset
|
||||
mysql_free_result($result);
|
||||
|
||||
/* Closing connection */
|
||||
// Closing connection
|
||||
mysql_close($link);
|
||||
?>
|
||||
]]>
|
||||
|
|
Loading…
Reference in a new issue