cvs: phpdoc-de /reference/mysql/functions mysql-affected-rows.xml mysql-close.xml mysql-connect.xml mysql-create-db.xml mysql-data-seek.xml
mysql-errno.xml mysql-error.xml mysql-fetch-array.xml mysql-fetch-field.xml mysql-fetch-object.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-list-tables.xml mysql-query.xml mysql-real-escape-string.xml
mysql-result.xml mysql-select-db.xml

From: Date: Mon, 31 May 2004 19:45:57 +0000
Subject: cvs: phpdoc-de /reference/mysql/functions mysql-affected-rows.xml mysql-close.xml mysql-connect.xml mysql-create-db.xml mysql-data-seek.xml
mysql-errno.xml mysql-error.xml mysql-fetch-array.xml mysql-fetch-field.xml mysql-fetch-object.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-list-tables.xml mysql-query.xml mysql-real-escape-string.xml
mysql-result.xml mysql-select-db.xml
Groups: php.doc.de 
Request: Send a blank email to doc-de+get-1192@lists.php.net to get a copy of this message
betz Mon May 31 15:45:57 2004 EDT Modified files: /phpdoc-de/reference/mysql/functions mysql-affected-rows.xml mysql-close.xml mysql-connect.xml mysql-create-db.xml mysql-data-seek.xml mysql-errno.xml mysql-error.xml mysql-fetch-array.xml mysql-fetch-field.xml mysql-fetch-object.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-list-tables.xml mysql-query.xml mysql-real-escape-string.xml mysql-result.xml mysql-select-db.xml Log: sync to en

http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-affected-rows.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-affected-rows.xml diff -u phpdoc-de/reference/mysql/functions/mysql-affected-rows.xml:1.7 phpdoc-de/reference/mysql/functions/mysql-affected-rows.xml:1.8 --- phpdoc-de/reference/mysql/functions/mysql-affected-rows.xml:1.7 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-affected-rows.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.13 Maintainer: betz Status: ready --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.15 Maintainer: betz Status: ready --> <refentry id="function.mysql-affected-rows"> <refnamediv> @@ -62,16 +62,19 @@ <![CDATA[ <?php /* Verbindung zur Datenabank */ -mysql_pconnect("localhost", "mysql_user", "mysql_password") - or die ("Keine Verbindung möglich: " : . mysql_error()); -mysql_select_db("mydb"); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} +mysql_select_db('mydb'); /* Das sollte die korrekte Anzahl gelöschter Datensätze liefern */ mysql_query("DELETE FROM mytable WHERE id < 10"); printf ("Datensätze gelöscht: %d\n", mysql_affected_rows()); -/* Ohne where Bedingung in einer Delete-Anweisung sollte 0 zurückgegeben werden */ -mysql_query("DELETE FROM mytable"); +// Mit einer where Bedingung, die niemals wahr sein kann, +// sollte 0 zurückgegben werden +mysql_query('DELETE FROM mytable WHERE 0'); printf ("Datensätze gelöscht: %d\n", mysql_affected_rows()); ?> ]]> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-close.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-close.xml diff -u phpdoc-de/reference/mysql/functions/mysql-close.xml:1.6 phpdoc-de/reference/mysql/functions/mysql-close.xml:1.7 --- phpdoc-de/reference/mysql/functions/mysql-close.xml:1.6 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-close.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.6 Maintainer: betz Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.8 Maintainer: betz Status: ready --> <refentry id="function.mysql-close"> <refnamediv> <refname>mysql_close</refname> @@ -38,14 +38,16 @@ </note> <para> <example> - <title>Verbindung zum Datenbankserver schließen</title> + <title><function>mysql_close</function> Beispiel</title> <programlisting role="php"> <![CDATA[ <?php -$link = mysql_connect("localhost", "mysql_user", "mysql_password") - or die("keine Verbindung möglich: " .mysql_error()); -echo "Verbindung erfolgreich"; -mysql_close ($link); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('keine Verbindung möglich: ' . mysql_error()); +} +echo 'Verbindung erfolgreich'; +mysql_close($link); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-connect.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-connect.xml diff -u phpdoc-de/reference/mysql/functions/mysql-connect.xml:1.9 phpdoc-de/reference/mysql/functions/mysql-connect.xml:1.10 --- phpdoc-de/reference/mysql/functions/mysql-connect.xml:1.9 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-connect.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.11 Maintainer: betz Status: ready --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.12 Maintainer: betz Status: ready --> <refentry id="function.mysql-connect"> <refnamediv> @@ -96,9 +96,11 @@ <programlisting role="php"> <![CDATA[ <?php -$link = mysql_connect("localhost", "mysql_user", "mysql_password") - or die("keine Verbindung möglich: " .mysql_error()); -echo "Verbindung erfolgreich"; +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('keine Verbindung möglich: ' . mysql_error()); +} +echo 'Verbindung erfolgreich'; mysql_close($link); ?> ]]> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-create-db.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-create-db.xml diff -u phpdoc-de/reference/mysql/functions/mysql-create-db.xml:1.8 phpdoc-de/reference/mysql/functions/mysql-create-db.xml:1.9 --- phpdoc-de/reference/mysql/functions/mysql-create-db.xml:1.8 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-create-db.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-create-db"> <refnamediv> @@ -28,13 +28,15 @@ <programlisting role="php"> <![CDATA[ <?php -$link = mysql_connect ("localhost", "mysql_user", "mysql_password") - or die("keine Verbindung möglich: ". mysql_error()); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('keine Verbindung möglich: ' . mysql_error()); +} -if (mysql_create_db("meine_db")) { +if (mysql_create_db('my_db')) { echo "Datenbank erfolgreich angelegt\n"; } else { - echo "Fehler beim Anlegen der Datenbank: " . mysql_error() . "\n"; + echo 'Fehler beim Anlegen der Datenbank ' . mysql_error() . "\n"; } ?> ]]> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-data-seek.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-data-seek.xml diff -u phpdoc-de/reference/mysql/functions/mysql-data-seek.xml:1.7 phpdoc-de/reference/mysql/functions/mysql-data-seek.xml:1.8 --- phpdoc-de/reference/mysql/functions/mysql-data-seek.xml:1.7 Wed Jan 28 05:56:06 2004 +++ phpdoc-de/reference/mysql/functions/mysql-data-seek.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.11 Maintainer: betz Status: ready --> <refentry id="function.mysql-data-seek"> <refnamediv> @@ -45,16 +45,19 @@ <programlisting role="php"> <![CDATA[ <?php -$link = mysql_connect("localhost", "mysql_user", "mysql_password") - or die("Keine Verbindung möglich: " . mysql_error()); - -mysql_select_db("samp_db") - or die("Auswahl der Datenbank nicht möglich: " . mysql_error()); - -$query = "SELECT nach_name, vor_name FROM freunde"; -$result = mysql_query($query) - or die("Anfrage fehlgeschlagen"); - +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} +$db_selected = mysql_select_db('sample_db'); +if (!$db_selected) { + die('Auswahl der Datenbank nicht möglich: ' . mysql_error()); +} +$query = 'SELECT nach_name, vor_name FROM freunde'; +$result = mysql_query($query); +if (!$result) { + die('Anfrage fehlgeschlagen: ' . mysql_error()); +} /* holen der Zeilen in umgekehrter Reihenfolge */ for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { if (!mysql_data_seek($result, $i)) { @@ -62,13 +65,14 @@ continue; } - if (!($row = mysql_fetch_object($result))) + if (!($row = mysql_fetch_assoc($result))) { continue; + } - echo "$row->nach_name $row->vor_name<br />\n"; + echo $row['nach_name'] . ' ' . $row['vor_name'] . "<br />\n"; } -mysql_free_result ($result); +mysql_free_result($result); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-errno.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-errno.xml diff -u phpdoc-de/reference/mysql/functions/mysql-errno.xml:1.7 phpdoc-de/reference/mysql/functions/mysql-errno.xml:1.8 --- phpdoc-de/reference/mysql/functions/mysql-errno.xml:1.7 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-errno.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.8 Maintainer: betz Status: ready --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-errno"> <refnamediv> @@ -38,15 +38,16 @@ <programlisting role="php"> <![CDATA[ <?php -mysql_connect("localhost", "mysql_user", "mysql_password"); +$link = mysql_connect("localhost", "mysql_user", "mysql_password"); -mysql_select_db("db_nicht_vorhanden"); -echo mysql_errno() . ": " . mysql_error(). "\n"; - -mysql_select_db("kossu"); -mysql_query("SELECT * FROM nicht_vorhandene_tabelle"); -echo mysql_errno() . ": " . mysql_error() . "\n"; +if (!mysql_select_db("db_nicht_vorhanden", $link)) { + echo mysql_errno($link) . ": " . mysql_error($link). "\n"; +} +mysql_select_db("kossu", $link); +if (!mysql_query("SELECT * FROM nicht_vorhandene_tabelle", $link)) { + echo mysql_errno($link) . ": " . mysql_error($link) . "\n"; +} ?> ]]> </programlisting> @@ -69,7 +70,8 @@ </para> </note> <para> - Siehe auch <function>mysql_error</function>. + Siehe auch <function>mysql_error</function> und + <ulink url="&url.mysql.docs.error;">MySQL Fehler Codes</ulink>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-error.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-error.xml diff -u phpdoc-de/reference/mysql/functions/mysql-error.xml:1.6 phpdoc-de/reference/mysql/functions/mysql-error.xml:1.7 --- phpdoc-de/reference/mysql/functions/mysql-error.xml:1.6 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-error.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.12 Maintainer: betz Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.13 Maintainer: betz Status: ready --> <refentry id="function.mysql-error"> <refnamediv> @@ -61,7 +61,8 @@ </example> </para> <para> - Siehe auch: <function>mysql_errno</function>. + Siehe auch: <function>mysql_errno</function> und + <ulink url="&url.mysql.docs.error.msg;">MySQL Fehlermeldungen</ulink>.. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-fetch-array.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-fetch-array.xml diff -u phpdoc-de/reference/mysql/functions/mysql-fetch-array.xml:1.9 phpdoc-de/reference/mysql/functions/mysql-fetch-array.xml:1.10 --- phpdoc-de/reference/mysql/functions/mysql-fetch-array.xml:1.9 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-fetch-array.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.13 Maintainer: betz Status: ready --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.14 Maintainer: betz Status: ready --> <refentry id="function.mysql-fetch-array"> <refnamediv> @@ -37,10 +37,10 @@ ihren ursprünglichen Namen zugreifen. (In folgendem Beispiel können Sie <literal>'field'</literal> nicht benutzen). <example> - <title>Abfrage mit identischen Feldnamen</title> + <title>Abfrage mit alias für identische Feldnamen</title> <programlisting role="sql"> <![CDATA[ -select table1.field as foo, table2.field as bar from table1, table2 +SELECT table1.field AS foo, table2.field AS bar FROM table1, table2 ]]> </programlisting> </example> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-fetch-field.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-fetch-field.xml diff -u phpdoc-de/reference/mysql/functions/mysql-fetch-field.xml:1.6 phpdoc-de/reference/mysql/functions/mysql-fetch-field.xml:1.7 --- phpdoc-de/reference/mysql/functions/mysql-fetch-field.xml:1.6 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-fetch-field.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-fetch-field"> <refnamediv> @@ -98,18 +98,22 @@ <programlisting role="php"> <![CDATA[ <?php -mysql_connect('localhost:3306', $user, $password) - or die ("Keine Verbindung möglich: ". mysql_error()); -mysql_select_db("database"); -$result = mysql_query("select * from table") - or die("Anfrage fehlgeschlagen: " . mysql_error()); +$conn = mysql_connect('localhost:3306', 'user', 'password'); +if (!$conn) { + die('Keine Verbindung möglich: ' . mysql_error()); +} +mysql_select_db('database'); +$result = mysql_query('select * from table'); +if (!$result) { + die('Anfrage fehlgeschlagen: ' . mysql_error()); +} /* Metadaten der Felder */ $i = 0; while ($i < mysql_num_fields($result)) { echo "Information für Feld $i:<br />\n"; $meta = mysql_fetch_field($result, $i); if (!$meta) { - echo "Keine Information vorhanden <br />\n"; + echo "Keine Information vorhanden<br />\n"; } echo "<pre> blob: $meta->blob http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-fetch-object.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-fetch-object.xml diff -u phpdoc-de/reference/mysql/functions/mysql-fetch-object.xml:1.5 phpdoc-de/reference/mysql/functions/mysql-fetch-object.xml:1.6 --- phpdoc-de/reference/mysql/functions/mysql-fetch-object.xml:1.5 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-fetch-object.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.7 Maintainer: betz Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.6 Maintainer: betz Status: ready --> <refentry id="function.mysql-fetch-object"> <refnamediv> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-field-name.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-field-name.xml diff -u phpdoc-de/reference/mysql/functions/mysql-field-name.xml:1.6 phpdoc-de/reference/mysql/functions/mysql-field-name.xml:1.7 --- phpdoc-de/reference/mysql/functions/mysql-field-name.xml:1.6 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-field-name.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.8 Maintainer: betz Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> <refentry id="function.mysql-field-name"> <refnamediv> @@ -47,12 +47,34 @@ $link = mysql_connect('localhost', "mysql_user", "mysql_password"); $dbname = "mydb"; mysql_select_db($dbname, $link) - or die("Auswahl der Datenabnk $dbname fehlgeschlagen: " . mysql_error()); + or die(": " . mysql_error()); $res = mysql_query("select * from users", $link); echo mysql_field_name($res, 0) . "\n"; echo mysql_field_name($res, 2); - ?> +?> +]]> +<![CDATA[ +<?php +/* The users table consists of three fields: + * user_id + * username + * password. + */ +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$db_selected) { + die('Auswahl der Datenabnk $dbname fehlgeschlagen: ' . mysql_error()); +} +$dbname = 'mydb'; +$db_selected = mysql_select_db($dbname, $link); +if (!$db_selected) { + die('Auswahl der Datenabnk $dbname fehlgeschlagen: ' . mysql_error()); +} +$res = mysql_query('select * from users', $link); + +echo mysql_field_name($res, 0) . "\n"; +echo mysql_field_name($res, 2); +?> ]]> </programlisting> <para> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-get-host-info.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-get-host-info.xml diff -u phpdoc-de/reference/mysql/functions/mysql-get-host-info.xml:1.6 phpdoc-de/reference/mysql/functions/mysql-get-host-info.xml:1.7 --- phpdoc-de/reference/mysql/functions/mysql-get-host-info.xml:1.6 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-get-host-info.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.8 Maintainer: betz Status: ready --> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> <refentry id="function.mysql-get-host-info"> <refnamediv> @@ -27,8 +27,10 @@ <programlisting role="php"> <![CDATA[ <?php -mysql_connect("localhost", "mysql_user", "mysql_password") - or die("Keine Verbindung möglich: " . mysql_error()); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} printf("MySQL host info: %s\n", mysql_get_host_info()); ?> ]]> @@ -44,9 +46,10 @@ </example> </para> <para> - See auch: <function>mysql_get_client_info</function>, - <function>mysql_get_proto_info</function> und - <function>mysql_get_server_info</function>. + Siehe auch + <function>mysql_get_client_info</function>, + <function>mysql_get_proto_info</function> und + <function>mysql_get_server_info</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-get-proto-info.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-get-proto-info.xml diff -u phpdoc-de/reference/mysql/functions/mysql-get-proto-info.xml:1.8 phpdoc-de/reference/mysql/functions/mysql-get-proto-info.xml:1.9 --- phpdoc-de/reference/mysql/functions/mysql-get-proto-info.xml:1.8 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-get-proto-info.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-get-proto-info"> <refnamediv> @@ -25,9 +25,11 @@ <programlisting role="php"> <![CDATA[ <?php -mysql_connect("localhost", "mysql_user", "mysql_password") - or die("Keine Verbindung möglich: " . mysql_error()); -printf ("MySQL protocol version: %s\n", mysql_get_proto_info()); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} +printf("MySQL protocol version: %s\n", mysql_get_proto_info()); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-get-server-info.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-get-server-info.xml diff -u phpdoc-de/reference/mysql/functions/mysql-get-server-info.xml:1.5 phpdoc-de/reference/mysql/functions/mysql-get-server-info.xml:1.6 --- phpdoc-de/reference/mysql/functions/mysql-get-server-info.xml:1.5 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-get-server-info.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.8 Maintainer: betz Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> <refentry id="function.mysql-get-server-info"> <refnamediv> @@ -25,8 +25,10 @@ <programlisting role="php"> <![CDATA[ <?php -mysql_connect("localhost", "mysql_user", "mysql_password") - or die("Keine Verbindung möglich: " . mysql_error()); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} printf("MySQL server version: %s\n", mysql_get_server_info()); ?> ]]> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-insert-id.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-insert-id.xml diff -u phpdoc-de/reference/mysql/functions/mysql-insert-id.xml:1.7 phpdoc-de/reference/mysql/functions/mysql-insert-id.xml:1.8 --- phpdoc-de/reference/mysql/functions/mysql-insert-id.xml:1.7 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-insert-id.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-insert-id"> <refnamediv> @@ -55,11 +55,23 @@ <![CDATA[ <?php mysql_connect("localhost", "mysql_user", "mysql_password") - or die("Keine Verbindung möglich: " . mysql_error()); + or die(": " . mysql_error()); mysql_select_db("mydb"); mysql_query("INSERT INTO mytable (product) values ('kossu')"); -printf ("Der letzte eingefügte Datensatz hat die ID %d\n", mysql_insert_id()); +printf (" %d\n", mysql_insert_id()); +?> +]]> +<![CDATA[ +<?php +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} +mysql_select_db('mydb'); + +mysql_query("INSERT INTO mytable (product) values ('kossu')"); +printf("Der zuletzt eingefügte Datensatz hat die ID %d\n", mysql_insert_id()); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-list-tables.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-list-tables.xml diff -u phpdoc-de/reference/mysql/functions/mysql-list-tables.xml:1.7 phpdoc-de/reference/mysql/functions/mysql-list-tables.xml:1.8 --- phpdoc-de/reference/mysql/functions/mysql-list-tables.xml:1.7 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-list-tables.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-list-tables"> <refnamediv> @@ -36,14 +36,15 @@ <function>mysql_listtables</function> verwendet werden. Diese Funktion ist jedoch veraltet. </para> - <para> - <note> - <simpara> - Diese Function ist veraltet und sollte nicht mehr benutzt werden. - Verwenden Sie stattdessen den SQL Befehl SHOW TABLES FROM DATABASE. - </simpara> - </note> - </para> + <note> + <para> + Die Funktion <function>mysql_list_tables</function> ist veraltet. + Stattdessen ist es vorzuziehen, <function>mysql_query</function> zu + benutzen und den SQL Befehl + <literal>SHOW TABLES [FROM db_name] [LIKE 'pattern']</literal> zu + verwenden. + </para> + </note> <para> <example> <title><function>mysql_list_tables</function> Beispiel</title> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-query.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-query.xml diff -u phpdoc-de/reference/mysql/functions/mysql-query.xml:1.9 phpdoc-de/reference/mysql/functions/mysql-query.xml:1.10 --- phpdoc-de/reference/mysql/functions/mysql-query.xml:1.9 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-query.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.9 Maintainer: betz Status: ready --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.10 Maintainer: betz Status: ready --> <refentry id="function.mysql-query"> <refnamediv> @@ -49,9 +49,11 @@ <title><function>mysql_query</function> Beispiel</title> <programlisting role="php"> <![CDATA[ -<php -$result = mysql_query ("SELECT * WHERE 1=1") - or die ("Ungültige Abfrage: " . mysql_error()); +<?php +$result = mysql_query('SELECT * WHERE 1=1'); +if (!$result) { + die('Ungültige Abfrage: ' . mysql_error()); +} ?> ]]> </programlisting> @@ -67,8 +69,10 @@ <programlisting role="php"> <![CDATA[ <?php -$result = mysql_query ("SELECT my_col FROM my_tbl") - or die ("Ungültige Abfrage: " . mysql_error()); +$result = mysql_query('SELECT my_col FROM my_tbl'); +if (!$result) { + die('Ungültige Abfrage: ' . mysql_error()); +} ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-real-escape-string.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-real-escape-string.xml diff -u phpdoc-de/reference/mysql/functions/mysql-real-escape-string.xml:1.3 phpdoc-de/reference/mysql/functions/mysql-real-escape-string.xml:1.4 --- phpdoc-de/reference/mysql/functions/mysql-real-escape-string.xml:1.3 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-real-escape-string.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> -<!-- EN-Revision: 1.7 Maintainer: betz Status: ready --> +<!-- $Revision: 1.4 $ --> +<!-- EN-Revision: 1.8 Maintainer: betz Status: ready --> <refentry id="function.mysql-real-escape-string"> <refnamediv> @@ -36,9 +36,12 @@ <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} $item = "Zak's und Derick's Laptop"; $escaped_item = mysql_real_escape_string($item, $link); -printf ("Escaped string: %s\n", $escaped_item); +printf("Escaped string: %s\n", $escaped_item); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-result.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-result.xml diff -u phpdoc-de/reference/mysql/functions/mysql-result.xml:1.5 phpdoc-de/reference/mysql/functions/mysql-result.xml:1.6 --- phpdoc-de/reference/mysql/functions/mysql-result.xml:1.5 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-result.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.6 Maintainer: betz Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.7 Maintainer: betz Status: ready --> <refentry id="function.mysql-result"> <refnamediv> @@ -43,11 +43,26 @@ <![CDATA[ <?php $link = mysql_connect("localhost", "mysql_user", "mysql_password") - or die("Keine Verbindung möglich: " . mysql_error()); + or die(": " . mysql_error()); $result = mysql_query("SELECT name FROM work.employee") - or die("Abfrage fehlgeschlagen:" . mysql_error()); + or die(":" . mysql_error()); +echo mysql_result($result, 2); // + +mysql_close($link); +?> +]]> +<![CDATA[ +<?php +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Keine Verbindung möglich: ' . mysql_error()); +} +$result = mysql_query('SELECT name FROM work.employee'); +if (!$result) { + die('Abfrage fehlgeschlagen:' . mysql_error()); +} echo mysql_result($result, 2); // gibt den Namen des dritten Angestellten aus mysql_close($link); http://cvs.php.net/diff.php/phpdoc-de/reference/mysql/functions/mysql-select-db.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-de/reference/mysql/functions/mysql-select-db.xml diff -u phpdoc-de/reference/mysql/functions/mysql-select-db.xml:1.5 phpdoc-de/reference/mysql/functions/mysql-select-db.xml:1.6 --- phpdoc-de/reference/mysql/functions/mysql-select-db.xml:1.5 Mon Jan 12 15:45:53 2004 +++ phpdoc-de/reference/mysql/functions/mysql-select-db.xml Mon May 31 15:45:56 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.6 Maintainer: betz Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.7 Maintainer: betz Status: ready --> <refentry id="function.mysql-select-db"> <refnamediv> @@ -36,12 +36,17 @@ <programlisting role="php"> <![CDATA[ <?php -$link = mysql_connect('localhost', 'mysql_user', 'mysql_password') - or die('Verbindung nicht möglich : ' . mysql_error()); + +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$link) { + die('Verbindung nicht möglich : ' . mysql_error()); +} // benutze Datenbank foo -mysql_select_db('foo', $link) - or die ('Kann foo nicht benutzen : ' . mysql_error()); +$db_selected = mysql_select_db('foo', $link); +if (!$db_selected) { + die ('Kann foo nicht benutzen : ' . mysql_error()); +} ?> ]]> </programlisting>
« previous php.doc.de (#1192) next »