From f46de98880ec05cfbbd9cc497e4a76b78d4d24da Mon Sep 17 00:00:00 2001 From: Stefan Walk Date: Fri, 20 Feb 2004 17:36:42 +0000 Subject: [PATCH] CS, minor bugs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@151948 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../mysql/functions/mysql-affected-rows.xml | 18 ++++++----- reference/mysql/functions/mysql-close.xml | 10 ++++--- reference/mysql/functions/mysql-connect.xml | 10 ++++--- reference/mysql/functions/mysql-create-db.xml | 12 ++++---- reference/mysql/functions/mysql-data-seek.xml | 30 +++++++++++-------- .../mysql/functions/mysql-fetch-field.xml | 16 ++++++---- .../mysql/functions/mysql-field-name.xml | 17 +++++++---- .../mysql/functions/mysql-get-host-info.xml | 8 +++-- .../mysql/functions/mysql-get-proto-info.xml | 8 +++-- .../mysql/functions/mysql-get-server-info.xml | 8 +++-- reference/mysql/functions/mysql-insert-id.xml | 10 ++++--- reference/mysql/functions/mysql-query.xml | 14 +++++---- .../functions/mysql-real-escape-string.xml | 8 +++-- reference/mysql/functions/mysql-result.xml | 16 +++++----- reference/mysql/functions/mysql-select-db.xml | 14 +++++---- 15 files changed, 120 insertions(+), 79 deletions(-) diff --git a/reference/mysql/functions/mysql-affected-rows.xml b/reference/mysql/functions/mysql-affected-rows.xml index 0ad9153788..c019ef13de 100644 --- a/reference/mysql/functions/mysql-affected-rows.xml +++ b/reference/mysql/functions/mysql-affected-rows.xml @@ -1,5 +1,5 @@ - + @@ -57,16 +57,18 @@ ]]> diff --git a/reference/mysql/functions/mysql-close.xml b/reference/mysql/functions/mysql-close.xml index 40a8c43bdd..a0065759bd 100644 --- a/reference/mysql/functions/mysql-close.xml +++ b/reference/mysql/functions/mysql-close.xml @@ -1,5 +1,5 @@ - + @@ -41,9 +41,11 @@ ]]> diff --git a/reference/mysql/functions/mysql-connect.xml b/reference/mysql/functions/mysql-connect.xml index d366fa6c74..5b6af22120 100644 --- a/reference/mysql/functions/mysql-connect.xml +++ b/reference/mysql/functions/mysql-connect.xml @@ -1,5 +1,5 @@ - + @@ -95,9 +95,11 @@ ]]> diff --git a/reference/mysql/functions/mysql-create-db.xml b/reference/mysql/functions/mysql-create-db.xml index 8af8d41490..1718ce5c5b 100644 --- a/reference/mysql/functions/mysql-create-db.xml +++ b/reference/mysql/functions/mysql-create-db.xml @@ -1,5 +1,5 @@ - + @@ -29,13 +29,15 @@ ]]> diff --git a/reference/mysql/functions/mysql-data-seek.xml b/reference/mysql/functions/mysql-data-seek.xml index 8839ba45bd..55697fe845 100644 --- a/reference/mysql/functions/mysql-data-seek.xml +++ b/reference/mysql/functions/mysql-data-seek.xml @@ -1,5 +1,5 @@ - + @@ -42,16 +42,19 @@ = 0; $i--) { if (!mysql_data_seek($result, $i)) { @@ -59,10 +62,11 @@ for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { continue; } - if (!($row = mysql_fetch_object($result))) + if (!($row = mysql_fetch_assoc($result))) { continue; + } - echo "$row->last_name $row->first_name
\n"; + echo $row['last_name'] . ' ' . $row['first_name'] . "
\n"; } mysql_free_result($result); diff --git a/reference/mysql/functions/mysql-fetch-field.xml b/reference/mysql/functions/mysql-fetch-field.xml index f73f30cfc3..5fcb95808d 100644 --- a/reference/mysql/functions/mysql-fetch-field.xml +++ b/reference/mysql/functions/mysql-fetch-field.xml @@ -1,5 +1,5 @@ - + @@ -98,11 +98,15 @@ - + @@ -42,11 +42,16 @@ * username * password. */ -$link = mysql_connect('localhost', "mysql_user", "mysql_password"); -$dbname = "mydb"; -mysql_select_db($dbname, $link) - or die("Could not set $dbname: " . mysql_error()); -$res = mysql_query("select * from users", $link); +$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); +if (!$db_selected) { + die('Could not set $dbname: ' . mysql_error()); +} +$dbname = 'mydb'; +$db_selected = mysql_select_db($dbname, $link); +if (!$db_selected) { + die('Could not set $dbname: ' . mysql_error()); +} +$res = mysql_query('select * from users', $link); echo mysql_field_name($res, 0) . "\n"; echo mysql_field_name($res, 2); diff --git a/reference/mysql/functions/mysql-get-host-info.xml b/reference/mysql/functions/mysql-get-host-info.xml index 223d0cb772..70f6ed76ef 100644 --- a/reference/mysql/functions/mysql-get-host-info.xml +++ b/reference/mysql/functions/mysql-get-host-info.xml @@ -1,5 +1,5 @@ - + @@ -25,8 +25,10 @@ ]]> diff --git a/reference/mysql/functions/mysql-get-proto-info.xml b/reference/mysql/functions/mysql-get-proto-info.xml index e0446190d6..34f8a6c145 100644 --- a/reference/mysql/functions/mysql-get-proto-info.xml +++ b/reference/mysql/functions/mysql-get-proto-info.xml @@ -1,5 +1,5 @@ - + @@ -25,8 +25,10 @@ ]]> diff --git a/reference/mysql/functions/mysql-get-server-info.xml b/reference/mysql/functions/mysql-get-server-info.xml index 2af2ded6f2..394866007b 100644 --- a/reference/mysql/functions/mysql-get-server-info.xml +++ b/reference/mysql/functions/mysql-get-server-info.xml @@ -1,5 +1,5 @@ - + @@ -25,8 +25,10 @@ ]]> diff --git a/reference/mysql/functions/mysql-insert-id.xml b/reference/mysql/functions/mysql-insert-id.xml index 02bf27296d..5e2b3d7baf 100644 --- a/reference/mysql/functions/mysql-insert-id.xml +++ b/reference/mysql/functions/mysql-insert-id.xml @@ -1,5 +1,5 @@ - + @@ -56,9 +56,11 @@ - + @@ -47,8 +47,10 @@ ]]> @@ -64,8 +66,10 @@ $result = mysql_query("SELECT * WHERE 1=1") ]]> diff --git a/reference/mysql/functions/mysql-real-escape-string.xml b/reference/mysql/functions/mysql-real-escape-string.xml index 4cf44aca8a..2b2c666eb2 100644 --- a/reference/mysql/functions/mysql-real-escape-string.xml +++ b/reference/mysql/functions/mysql-real-escape-string.xml @@ -1,5 +1,5 @@ - + @@ -33,8 +33,10 @@ - + @@ -43,12 +43,14 @@ - + @@ -37,12 +37,16 @@ ]]>