pollita Sun Dec 1 21:37:30 2002 EDT Modified files: /phpdoc/en/reference/mysql/functions mysql-affected-rows.xml mysql-close.xml mysql-create-db.xml mysql-data-seek.xml mysql-fetch-array.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-query.xml Log: Documentation Bug #20743. Added usage of mysql_error() to examples.
Index: phpdoc/en/reference/mysql/functions/mysql-affected-rows.xml diff -u phpdoc/en/reference/mysql/functions/mysql-affected-rows.xml:1.5 phpdoc/en/reference/mysql/functions/mysql-affected-rows.xml:1.6 --- phpdoc/en/reference/mysql/functions/mysql-affected-rows.xml:1.5 Sun May 12 14:53:04 2002 +++ phpdoc/en/reference/mysql/functions/mysql-affected-rows.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-affected-rows"> <refnamediv> @@ -58,7 +58,7 @@ <?php /* connect to database */ mysql_pconnect("localhost", "mysql_user", "mysql_password") or - die ("Could not connect"); + die("Could not connect: " . mysql_error()); /* this should return the correct numbers of deleted records */ mysql_query("DELETE FROM mytable WHERE id < 10"); @@ -87,7 +87,7 @@ <?php /* connect to database */ mysql_pconnect("localhost", "mysql_user", "mysql_password") or - die ("Could not connect"); + die("Could not connect: " . mysql_error()); /* Update records */ mysql_query("UPDATE mytable SET used=1 WHERE id < 10"); Index: phpdoc/en/reference/mysql/functions/mysql-close.xml diff -u phpdoc/en/reference/mysql/functions/mysql-close.xml:1.2 phpdoc/en/reference/mysql/functions/mysql-close.xml:1.3 --- phpdoc/en/reference/mysql/functions/mysql-close.xml:1.2 Wed Apr 17 02:41:05 2002 +++ phpdoc/en/reference/mysql/functions/mysql-close.xml Sun Dec 1 21:37:29 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-close"> <refnamediv> @@ -41,7 +41,7 @@ <![CDATA[ <?php $link = mysql_connect("localhost", "mysql_user", "mysql_password") - or exit("Could not connect"); + or die("Could not connect: " . mysql_error()); print ("Connected successfully"); mysql_close($link); ?> Index: phpdoc/en/reference/mysql/functions/mysql-create-db.xml diff -u phpdoc/en/reference/mysql/functions/mysql-create-db.xml:1.3 phpdoc/en/reference/mysql/functions/mysql-create-db.xml:1.4 --- phpdoc/en/reference/mysql/functions/mysql-create-db.xml:1.3 Sun Apr 21 09:03:37 2002 +++ phpdoc/en/reference/mysql/functions/mysql-create-db.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-create-db"> <refnamediv> @@ -29,12 +29,12 @@ <![CDATA[ <?php $link = mysql_pconnect("localhost", "mysql_user", "mysql_password") - or exit("Could not connect"); + or die("Could not connect: " . mysql_error()); if (mysql_create_db("my_db")) { print ("Database created successfully\n"); } else { - printf ("Error creating database: %s\n", mysql_error ()); + printf ("Error creating database: %s\n", mysql_error()); } ?> ]]> Index: phpdoc/en/reference/mysql/functions/mysql-data-seek.xml diff -u phpdoc/en/reference/mysql/functions/mysql-data-seek.xml:1.4 phpdoc/en/reference/mysql/functions/mysql-data-seek.xml:1.5 --- phpdoc/en/reference/mysql/functions/mysql-data-seek.xml:1.4 Mon Apr 29 05:13:35 2002 +++ phpdoc/en/reference/mysql/functions/mysql-data-seek.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-data-seek"> <refnamediv> @@ -40,19 +40,19 @@ <![CDATA[ <?php $link = mysql_pconnect("localhost", "mysql_user", "mysql_password") - or die("Could not connect"); + or die("Could not connect: " . mysql_error()); mysql_select_db("samp_db") - or exit("Could not select database"); + or die("Could not select database: " . mysql_error()); $query = "SELECT last_name, first_name FROM friends"; $result = mysql_query($query) - or die("Query failed"); + or die("Query failed: " . mysql_error()); /* fetch rows in reverse order */ for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { if (!mysql_data_seek($result, $i)) { - echo "Cannot seek to row $i\n"; + echo "Cannot seek to row $i: " . mysql_error() . "\n"; continue; } Index: phpdoc/en/reference/mysql/functions/mysql-fetch-array.xml diff -u phpdoc/en/reference/mysql/functions/mysql-fetch-array.xml:1.5 phpdoc/en/reference/mysql/functions/mysql-fetch-array.xml:1.6 --- phpdoc/en/reference/mysql/functions/mysql-fetch-array.xml:1.5 Mon May 20 15:24:28 2002 +++ phpdoc/en/reference/mysql/functions/mysql-fetch-array.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.27 --> <refentry id="function.mysql-fetch-array"> <refnamediv> @@ -69,7 +69,7 @@ <![CDATA[ <?php mysql_connect("localhost", "mysql_user", "mysql_password") or - die("could not connect"); + die("Could not connect: " . 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("Could not connect: " . 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("Could not connect: " . mysql_error()); mysql_select_db("mydb"); $result = mysql_query("SELECT id, name FROM mytable"); Index: phpdoc/en/reference/mysql/functions/mysql-fetch-field.xml diff -u phpdoc/en/reference/mysql/functions/mysql-fetch-field.xml:1.3 phpdoc/en/reference/mysql/functions/mysql-fetch-field.xml:1.4 --- phpdoc/en/reference/mysql/functions/mysql-fetch-field.xml:1.3 Sat May 25 17:10:46 2002 +++ phpdoc/en/reference/mysql/functions/mysql-fetch-field.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-fetch-field"> <refnamediv> @@ -97,10 +97,10 @@ <![CDATA[ <?php mysql_connect('localhost:3306', $user, $password) - or die ("Could not connect"); + or die("Could not connect: " . mysql_error()); mysql_select_db("database"); $result = mysql_query("select * from table") - or die("Query failed"); + or die("Query failed: " . mysql_error()); /* get column metadata */ $i = 0; while ($i < mysql_num_fields($result)) { Index: phpdoc/en/reference/mysql/functions/mysql-field-name.xml diff -u phpdoc/en/reference/mysql/functions/mysql-field-name.xml:1.2 phpdoc/en/reference/mysql/functions/mysql-field-name.xml:1.3 --- phpdoc/en/reference/mysql/functions/mysql-field-name.xml:1.2 Wed Apr 17 02:41:11 2002 +++ phpdoc/en/reference/mysql/functions/mysql-field-name.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-field-name"> <refnamediv> @@ -42,7 +42,7 @@ */ $link = mysql_connect('localhost', "mysql_user", "mysql_password"); mysql_select_db($dbname, $link) - or die("Could not set $dbname"); + or die("Could not set $dbname: " . mysql_error()); $res = mysql_query("select * from users", $link); echo mysql_field_name($res, 0) . "\n"; Index: phpdoc/en/reference/mysql/functions/mysql-get-host-info.xml diff -u phpdoc/en/reference/mysql/functions/mysql-get-host-info.xml:1.4 phpdoc/en/reference/mysql/functions/mysql-get-host-info.xml:1.5 --- phpdoc/en/reference/mysql/functions/mysql-get-host-info.xml:1.4 Sun Apr 21 12:34:47 2002 +++ phpdoc/en/reference/mysql/functions/mysql-get-host-info.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 --> <refentry id="function.mysql-get-host-info"> <refnamediv> @@ -25,7 +25,7 @@ <![CDATA[ <?php mysql_connect("localhost", "mysql_user", "mysql_password") or - die("could not connect"); + die("Could not connect: " . mysql_error()); printf ("MySQL host info: %s\n", mysql_get_host_info()); ?> ]]> Index: phpdoc/en/reference/mysql/functions/mysql-get-proto-info.xml diff -u phpdoc/en/reference/mysql/functions/mysql-get-proto-info.xml:1.4 phpdoc/en/reference/mysql/functions/mysql-get-proto-info.xml:1.5 --- phpdoc/en/reference/mysql/functions/mysql-get-proto-info.xml:1.4 Sun Apr 21 12:34:47 2002 +++ phpdoc/en/reference/mysql/functions/mysql-get-proto-info.xml Sun Dec 1 +21:37:29 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 --> <refentry id="function.mysql-get-proto-info"> <refnamediv> @@ -25,7 +25,7 @@ <![CDATA[ <?php mysql_connect("localhost", "mysql_user", "mysql_password") or - die("could not connect"); + die("Could not connect: " . mysql_error()); printf ("MySQL protocol version: %s\n", mysql_get_proto_info()); ?> ]]> Index: phpdoc/en/reference/mysql/functions/mysql-get-server-info.xml diff -u phpdoc/en/reference/mysql/functions/mysql-get-server-info.xml:1.4 phpdoc/en/reference/mysql/functions/mysql-get-server-info.xml:1.5 --- phpdoc/en/reference/mysql/functions/mysql-get-server-info.xml:1.4 Sun Apr 21 12:34:47 2002 +++ phpdoc/en/reference/mysql/functions/mysql-get-server-info.xml Sun Dec 1 +21:37:29 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.96 --> <refentry id="function.mysql-get-server-info"> <refnamediv> @@ -25,7 +25,7 @@ <![CDATA[ <?php mysql_connect("localhost", "mysql_user", "mysql_password") or - die("could not connect"); + die("Could not connect: " . mysql_error()); printf ("MySQL server version: %s\n", mysql_get_server_info()); ?> ]]> Index: phpdoc/en/reference/mysql/functions/mysql-insert-id.xml diff -u phpdoc/en/reference/mysql/functions/mysql-insert-id.xml:1.5 phpdoc/en/reference/mysql/functions/mysql-insert-id.xml:1.6 --- phpdoc/en/reference/mysql/functions/mysql-insert-id.xml:1.5 Fri Jun 21 08:50:59 2002 +++ phpdoc/en/reference/mysql/functions/mysql-insert-id.xml Sun Dec 1 21:37:29 +2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 --> <refentry id="function.mysql-insert-id"> <refnamediv> @@ -56,7 +56,7 @@ <![CDATA[ <?php mysql_connect("localhost", "mysql_user", "mysql_password") or - die("could not connect"); + die("Could not connect: " . mysql_error()); mysql_select_db("mydb"); mysql_query("INSERT INTO mytable (product) values ('kossu')"); Index: phpdoc/en/reference/mysql/functions/mysql-query.xml diff -u phpdoc/en/reference/mysql/functions/mysql-query.xml:1.3 phpdoc/en/reference/mysql/functions/mysql-query.xml:1.4 --- phpdoc/en/reference/mysql/functions/mysql-query.xml:1.3 Wed Apr 17 02:41:13 2002 +++ phpdoc/en/reference/mysql/functions/mysql-query.xml Sun Dec 1 21:37:29 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 --> <refentry id="function.mysql-query"> <refnamediv> @@ -56,7 +56,7 @@ <![CDATA[ <php $result = mysql_query("SELECT * WHERE 1=1") - or die("Invalid query"); + or die("Invalid query: " . mysql_error()); ?> ]]> </programlisting> @@ -73,7 +73,7 @@ <![CDATA[ <?php $result = mysql_query("SELECT my_col FROM my_tbl") - or die ("Invalid query"); + or die("Invalid query: " . mysql_error()); ?> ]]> </programlisting>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php