cvs: phpdoc-nl /reference/mysql/functions mysql-affected-rows.xml mysql-client-encoding.xml mysql-close.xml mysql-connect.xml mysql-create-db.xml mysql-data-seek.xml mysql-db-query.xml mysql-fetch-array.xml mysql-fetch-assoc.xml mysql-fetch-field.xml mysql-field-name.xml mysql-get-host-info.xml mysql-get-proto-info.xml mysql-get-server-info.xml mysql-insert-id.xml mysql-stat.xml
[email protected] ("Dirkjan Ochtman")
| Newsgroups | php.doc.nl |
|---|---|
| Message-ID | <cvsmanuzhai1042116957@cvsserver> |
manuzhai Thu Jan 9 07:55:57 2003 EDT
Added files:
/phpdoc-nl/reference/mysql/functions mysql-client-encoding.xml
Modified files:
/phpdoc-nl/reference/mysql/functions mysql-affected-rows.xml
mysql-close.xml
mysql-connect.xml
mysql-create-db.xml
mysql-data-seek.xml
mysql-db-query.xml
mysql-fetch-array.xml
mysql-fetch-assoc.xml
mysql-fetch-field.xml
mysql-field-name.xml
mysql-get-host-info.xml
mysql-get-proto-info.xml
mysql-get-server-info.xml
mysql-insert-id.xml
mysql-stat.xml
Log:
Synced to EN.
manuzhai-20030109075557.txt
(text/plain, 18.3 KB)
Index: phpdoc-nl/reference/mysql/functions/mysql-affected-rows.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-affected-rows.xml:1.6 phpdoc-nl/reference/mysql/functions/mysql-affected-rows.xml:1.7
--- phpdoc-nl/reference/mysql/functions/mysql-affected-rows.xml:1.6 Fri May 24 13:18:44 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-affected-rows.xml Thu Jan 9 07:55:56 2003
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
-<!-- EN-Revision: 1.5 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.6 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-affected-rows">
<refnamediv>
<refname>mysql_affected_rows</refname>
@@ -58,7 +57,7 @@
<?php
/* Verbinding maken met de database */
mysql_pconnect("localhost", "mysql_user", "mysql_password") or
- die ("Kan geen verbinding maken");
+ die("Kan geen verbinding maken: " . mysql_error());
/* Dit zou het correcte aantal gedelete records terug moeten geven */
mysql_query("DELETE FROM mytable WHERE id < 10");
@@ -87,7 +86,7 @@
<?php
/* Verbinding maken met de database */
mysql_pconnect("localhost", "mysql_user", "mysql_password") or
- die ("Kan geen verbinding maken");
+ die("Kan geen verbinding maken: " . mysql_error());
/* Update records */
mysql_query("UPDATE mytable SET used=1 WHERE id < 10");
Index: phpdoc-nl/reference/mysql/functions/mysql-close.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-close.xml:1.3 phpdoc-nl/reference/mysql/functions/mysql-close.xml:1.4
--- phpdoc-nl/reference/mysql/functions/mysql-close.xml:1.3 Mon Apr 29 06:36:54 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-close.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.2 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.3 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-close">
<refnamediv>
<refname>mysql_close</refname>
@@ -40,7 +40,7 @@
<![CDATA[
<?php
$link = mysql_connect("kraemer", "marliesle", "secret")
- or exit("Kan niet verbinden");
+ or exit("Kan niet verbinden: " . mysql_error());
print ("Verbinding tot stand gebracht");
mysql_close($link);
?>
Index: phpdoc-nl/reference/mysql/functions/mysql-connect.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-connect.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-connect.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-connect.xml:1.4 Wed Aug 14 06:14:10 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-connect.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.3 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-connect">
<refnamediv>
<refname>mysql_connect</refname>
@@ -87,7 +87,7 @@
<![CDATA[
<?php
$link = mysql_connect("localhost", "username", "secret")
- or die("Kan niet verbinden");
+ or die("Kan niet verbinden: " . mysql_error());
print ("Verbinding tot stand gebracht");
mysql_close($link);
?>
Index: phpdoc-nl/reference/mysql/functions/mysql-create-db.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-create-db.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-create-db.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-create-db.xml:1.4 Mon Apr 29 05:30:53 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-create-db.xml Thu Jan 9 07:55:57 2003
@@ -27,7 +27,7 @@
<![CDATA[
<?php
$link = mysql_pconnect("kron", "jutta", "geheim")
- or exit("Kan geen verbinding maken");
+ or exit("Kan geen verbinding maken: " . mysql_error());
if (mysql_create_db("my_db")) {
print ("Database succesvol gemaakt\n");
} else {
Index: phpdoc-nl/reference/mysql/functions/mysql-data-seek.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-data-seek.xml:1.5 phpdoc-nl/reference/mysql/functions/mysql-data-seek.xml:1.6
--- phpdoc-nl/reference/mysql/functions/mysql-data-seek.xml:1.5 Mon Apr 29 05:35:54 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-data-seek.xml Thu Jan 9 07:55:57 2003
@@ -42,14 +42,14 @@
<![CDATA[
<?php
$link = mysql_pconnect("kron", "jutta", "geheim")
- or die("Kan geen verbinding maken");
+ or die("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("samp_db")
- or exit("Kan geen database selecteren");
+ or exit("Kan geen database selecteren: " . mysql_error());
$query = "SELECT last_name, first_name FROM friends";
$result = mysql_query($query)
- or die("Query heeft gefaald");
+ or die("Query heeft gefaald: " . mysql_error());
// fetch rows in reverse order
Index: phpdoc-nl/reference/mysql/functions/mysql-db-query.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-db-query.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-db-query.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-db-query.xml:1.4 Sat Jun 15 05:11:39 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-db-query.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.3 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-db-query">
<refnamediv>
<refname>mysql_db_query</refname>
@@ -17,7 +17,9 @@
</methodsynopsis>
<para>
Geeft een positieve MySQL resultaat resource voor het resultaat van de
- query terug, of &false; bij een fout.
+ query terug, of &false; bij een fout. De functie geeft ook &true;/&false;
+ terug bij <literal>INSERT</literal>/<literal>UPDATE</literal>/
+ <literal>DELETE</literal> queries om succes of mislukking aan te geven.
</para>
<para>
<function>mysql_db_query</function> selecteert een database en
Index: phpdoc-nl/reference/mysql/functions/mysql-fetch-array.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-fetch-array.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-fetch-array.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-fetch-array.xml:1.4 Mon May 20 15:25:18 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-fetch-array.xml Thu Jan 9 07:55:57 2003
@@ -69,7 +69,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("could not connect");
+ die("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
@@ -89,7 +89,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("could not connect");
+ die("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
@@ -109,7 +109,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("could not connect");
+ die("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
Index: phpdoc-nl/reference/mysql/functions/mysql-fetch-assoc.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-fetch-assoc.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-fetch-assoc.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-fetch-assoc.xml:1.4 Sat May 11 07:11:58 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-fetch-assoc.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.3 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-fetch-assoc">
<refnamediv>
<refname>mysql_fetch_assoc</refname>
@@ -41,18 +41,48 @@
</para>
<example>
- <title><function>mysql_fetch_assoc</function> voorbeeld</title>
+ <title>Een uitgebreid <function>mysql_fetch_assoc</function> voorbeeld</title>
<programlisting role="php">
<![CDATA[
<?php
- mysql_connect("localhost", "mysql_user", "mysql_password");
- mysql_select_db("mydb");
- $query = "select * from table";
- $result = mysql_query($query);
+
+ $conn = mysql_connect("localhost", "mysql_user", "mysql_password");
+
+ if (!$conn) {
+ echo "Kan geen verbinding maken met de DB: " . mysql_error();
+ exit;
+ }
+
+ if (!mysql_select_db("mydbname")) {
+ echo "Kan mydbname niet selecteren: "
+ }
+
+ $sql = "SELECT id as userid, fullname, userstatus
+ FROM sometable
+ WHERE userstatus = 1";
+
+ $result = mysql_query($sql);
+
+ if (!$result) {
+ echo "Kon de query ($sql) niet uitvoeren: " . mysql_error();
+ exit;
+ }
+
+ if (mysql_num_rows($result) == 0) {
+ echo "Geen rijen gevonden, niets te printen, dus stoppen.";
+ exit;
+ }
+
+ // Terwijl er nog een rij met data is, stop die rij in $row als een
+ // associatieve array. Als je slechts een rij terug verwacht, hoef je
+ // geen loop te gebruiken. Als je extract($row); binnen de volgende
+ // loop plaatst, ontstaan $userid, $fullname en $userstatus.
while ($row = mysql_fetch_assoc($result)) {
- echo $row["user_id"];
+ echo $row["userid"];
echo $row["fullname"];
+ echo $row["userstatus"];
}
+
mysql_free_result($result);
?>
]]>
Index: phpdoc-nl/reference/mysql/functions/mysql-fetch-field.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-fetch-field.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-fetch-field.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-fetch-field.xml:1.4 Sat Jun 15 05:11:39 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-fetch-field.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.3 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-fetch-field">
<refnamediv>
<refname>mysql_fetch_field</refname>
@@ -96,10 +96,10 @@
<![CDATA[
<?php
mysql_connect('localhost:3306', $user, $password)
- or die ("Kan geen verbinding maken");
+ or die ("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("database");
$result = mysql_query("select * from table")
- or die("Query heeft gefaald");
+ or die("Query heeft gefaald: " . mysql_error());
/* get column metadata */
$i = 0;
while ($i < mysql_num_fields($result)) {
Index: phpdoc-nl/reference/mysql/functions/mysql-field-name.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-field-name.xml:1.3 phpdoc-nl/reference/mysql/functions/mysql-field-name.xml:1.4
--- phpdoc-nl/reference/mysql/functions/mysql-field-name.xml:1.3 Mon Apr 29 06:30:36 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-field-name.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.2 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.3 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-field-name">
<refnamediv>
<refname>mysql_field_name</refname>
@@ -40,7 +40,7 @@
// password.
$link = mysql_connect('localhost', $user, "secret");
mysql_select_db($dbname, $link)
- or die("Kan $dbname niet selecteren");
+ or die("Kan $dbname niet selecteren: " . mysql_error());
$res = mysql_query("select * from users", $link);
echo mysql_field_name($res, 0) . "\n";
Index: phpdoc-nl/reference/mysql/functions/mysql-get-host-info.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-get-host-info.xml:1.3 phpdoc-nl/reference/mysql/functions/mysql-get-host-info.xml:1.4
--- phpdoc-nl/reference/mysql/functions/mysql-get-host-info.xml:1.3 Mon Apr 29 06:30:36 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-get-host-info.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.5 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-get-host-info">
<refnamediv>
<refname>mysql_get_host_info</refname>
@@ -24,7 +24,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("Kan geen verbinding maken");
+ die("Kan geen verbinding maken: " . mysql_error());
printf ("MySQL host info: %s\n", mysql_get_host_info());
?>
]]>
Index: phpdoc-nl/reference/mysql/functions/mysql-get-proto-info.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-get-proto-info.xml:1.3 phpdoc-nl/reference/mysql/functions/mysql-get-proto-info.xml:1.4
--- phpdoc-nl/reference/mysql/functions/mysql-get-proto-info.xml:1.3 Mon Apr 29 06:30:36 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-get-proto-info.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.5 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-get-proto-info">
<refnamediv>
<refname>mysql_get_proto_info</refname>
@@ -24,7 +24,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("Kan geen verbinding maken");
+ die("Kan geen verbinding maken: " . mysql_error());
printf ("MySQL protocol version: %s\n", mysql_get_proto_info());
?>
]]>
Index: phpdoc-nl/reference/mysql/functions/mysql-get-server-info.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-get-server-info.xml:1.2 phpdoc-nl/reference/mysql/functions/mysql-get-server-info.xml:1.3
--- phpdoc-nl/reference/mysql/functions/mysql-get-server-info.xml:1.2 Mon Apr 29 06:30:36 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-get-server-info.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.4 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.5 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-get-server-info">
<refnamediv>
<refname>mysql_get_server_info</refname>
@@ -24,7 +24,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("Kan geen verbinding maken");
+ die("Kan geen verbinding maken: " . mysql_error());
printf ("MySQL server version: %s\n", mysql_get_server_info());
?>
]]>
Index: phpdoc-nl/reference/mysql/functions/mysql-insert-id.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-insert-id.xml:1.5 phpdoc-nl/reference/mysql/functions/mysql-insert-id.xml:1.6
--- phpdoc-nl/reference/mysql/functions/mysql-insert-id.xml:1.5 Wed Aug 14 06:14:10 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-insert-id.xml Thu Jan 9 07:55:57 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.5 Maintainer: manuzhai Status: ready -->
+<!-- EN-Revision: 1.6 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-insert-id">
<refnamediv>
<refname>mysql_insert_id</refname>
@@ -52,7 +52,7 @@
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
- die("Kan geen verbinding maken");
+ die("Kan geen verbinding maken: " . mysql_error());
mysql_select_db("mydb");
mysql_query("INSERT INTO mytable (product) values ('kossu')");
Index: phpdoc-nl/reference/mysql/functions/mysql-stat.xml
diff -u phpdoc-nl/reference/mysql/functions/mysql-stat.xml:1.4 phpdoc-nl/reference/mysql/functions/mysql-stat.xml:1.5
--- phpdoc-nl/reference/mysql/functions/mysql-stat.xml:1.4 Wed Aug 14 06:14:10 2002
+++ phpdoc-nl/reference/mysql/functions/mysql-stat.xml Thu Jan 9 07:55:57 2003
@@ -27,16 +27,26 @@
<title>MySQL stat voorbeeld</title>
<programlisting role="php">
<![CDATA[
-$link = mysql_connect('localhost', $user, "secret");
-printf("%s\n", mysql_stat($link));
+$link = mysql_connect('localhost', "mysql_user", "mysql_password");
+$status = explode(' ', mysql_stat($link));
+print_r($status);
]]>
</programlisting>
<para>
Het bovenstaande voorbeeld zou de volgende output produceren.
<screen>
<![CDATA[
-Uptime: 5380 Threads: 1 Questions: 1321299 Slow queries: 1 Opens: 26 Flush tables: 1 Open tables: 17 Queries per second avg: 245.595
-
+Array
+(
+ [0] => Uptime: 5380
+ [1] => Threads: 2
+ [2] => Questions: 1321299
+ [3] => Slow queries: 0
+ [4] => Opens: 26
+ [5] => Flush tables: 1
+ [6] => Open tables: 17
+ [7] => Queries per second avg: 245.595
+)
]]>
</screen>
</para>
Index: phpdoc-nl/reference/mysql/functions/mysql-client-encoding.xml
+++ phpdoc-nl/reference/mysql/functions/mysql-client-encoding.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- EN-Revision: 1.2 Maintainer: manuzhai Status: ready -->
<refentry id="function.mysql-character-set-name">
<refnamediv>
<refname>mysql_character_set_name</refname>
<refpurpose>Geeft de naam van de character set terug</refpurpose>
</refnamediv>
<refsect1>
<title>Beschrijving</title>
<methodsynopsis>
<type>int</type><methodname>mysql_character_set_name</methodname>
<methodparam choice="opt"><type>resource</type>
<parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_character_set_name</function> geeft de default
character set naam terug voor de huidige connectie.
</para>
<example>
<title><function>mysql_character_set_name</function>
voorbeeld</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$charset = mysql_character_set_name($link);
printf ("Huidige character set is %s\n", $charset);
?>
]]>
</programlisting>
<para>
Het bovenstaande voorbeeld zou de volgende output genereren:
<screen>
<![CDATA[
current character set is latin1
]]>
</screen>
</para>
</example>
<para>
Zie ook:
<function>mysql_real_escape_string</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->