diff --git a/reference/mysql/functions/mysql-affected-rows.xml b/reference/mysql/functions/mysql-affected-rows.xml index 2a413d6e0f..1f8e510e86 100644 --- a/reference/mysql/functions/mysql-affected-rows.xml +++ b/reference/mysql/functions/mysql-affected-rows.xml @@ -1,5 +1,5 @@ - + @@ -59,7 +59,8 @@ /* connect to database */ mysql_pconnect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); - + mysql_select_db("mydb"); + /* this should return the correct numbers of deleted records */ mysql_query("DELETE FROM mytable WHERE id < 10"); printf ("Records deleted: %d\n", mysql_affected_rows()); @@ -88,6 +89,7 @@ Records deleted: 0 /* connect to database */ mysql_pconnect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); + mysql_select_db("mydb"); /* Update records */ mysql_query("UPDATE mytable SET used=1 WHERE id < 10"); diff --git a/reference/mysql/functions/mysql-fetch-object.xml b/reference/mysql/functions/mysql-fetch-object.xml index 0dd69bda21..8f1be2b70a 100644 --- a/reference/mysql/functions/mysql-fetch-object.xml +++ b/reference/mysql/functions/mysql-fetch-object.xml @@ -1,5 +1,5 @@ - + @@ -48,8 +48,8 @@ echo $row->0; user_id; echo $row->fullname; diff --git a/reference/mysql/functions/mysql-field-name.xml b/reference/mysql/functions/mysql-field-name.xml index 58e0187e2b..437d88a18f 100644 --- a/reference/mysql/functions/mysql-field-name.xml +++ b/reference/mysql/functions/mysql-field-name.xml @@ -1,5 +1,5 @@ - + @@ -41,6 +41,7 @@ * 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); diff --git a/reference/mysql/functions/mysql-real-escape-string.xml b/reference/mysql/functions/mysql-real-escape-string.xml index 3061e9204b..956361f106 100644 --- a/reference/mysql/functions/mysql-real-escape-string.xml +++ b/reference/mysql/functions/mysql-real-escape-string.xml @@ -1,5 +1,5 @@ - + @@ -32,7 +32,6 @@