diff --git a/functions/mysql.xml b/functions/mysql.xml index f35e9c2d2f..c787bb7f55 100644 --- a/functions/mysql.xml +++ b/functions/mysql.xml @@ -1,5 +1,5 @@ - + MySQL Functions MySQL @@ -26,6 +26,60 @@ Documentation for MySQL can be found at &url.mysql.docs;. + + The behaviour of the MySQL functions is affected by settings in the global + configuration file. + + <link linkend="ini.sect.mysql">MySQL Configuration </link> Options + + + + Name + Default + Changeable + + + + + mysql.allow_persistent + "On" + PHP_INI_SYSTEM + + + mysql.max_persistent + "-1" + PHP_INI_SYSTEM + + + mysql.max_links + "-1" + PHP_INI_SYSTEM + + + mysql.default_port + NULL + PHP_INI_ALL + + + mysql.default_socket + NULL + PHP_INI_ALL + + + mysql.default_host + NULL + PHP_INI_ALL + + + mysql.default_user + NULL + PHP_INI_ALL + + + +
+ For further details and definition of the PHP_INI_* constants see ini_set. +
This simple example shows how to connect, execute a query, print resulting rows and disconnect from a MySQL database. @@ -217,10 +271,10 @@ mysql_close($link); ]]> @@ -304,10 +358,10 @@ mysql_close($link); ]]> @@ -350,9 +404,9 @@ mysql_close($link); - &return.success; + &return.success; mysql_data_seek moves the internal row @@ -402,31 +456,31 @@ mysql_close($link); =0; $i--) { - if (!mysql_data_seek ($result, $i)) { + for ($i = mysql_num_rows($result) - 1; $i >=0; $i--) { + if (!mysql_data_seek($result, $i)) { echo "Cannot seek to row $i\n"; continue; } - if(!($row = mysql_fetch_object ($result))) + if(!($row = mysql_fetch_object($result))) continue; echo "$row->last_name $row->first_name
\n"; } - mysql_free_result ($result); + mysql_free_result($result); ?> ]]>
@@ -786,15 +840,16 @@ select tone.field as foo ttwo.field as bar from tone, ttwo \n"; echo "user_id: ".$row[0]."
\n"; echo "fullname: ".$row["fullname"]."
\n"; echo "fullname: ".$row[1]."
\n"; } -mysql_free_result ($result); +mysql_free_result($result); ?> ]]>
@@ -854,13 +909,15 @@ mysql_free_result ($result); ]]> @@ -967,15 +1024,16 @@ mysql_free_result ($result); \n"; - $meta = mysql_fetch_field ($result); + $meta = mysql_fetch_field($result); if (!$meta) { echo "No information available
\n"; } @@ -995,7 +1053,7 @@ zerofill: $meta->zerofill "; $i++; } -mysql_free_result ($result); +mysql_free_result($result); ?> ]]>
@@ -1086,13 +1144,14 @@ mysql_free_result ($result); user_id; echo $row->fullname; } -mysql_free_result ($result); +mysql_free_result($result); ?> ]]> @@ -1217,8 +1276,10 @@ mysql_free_result ($result); // user_id // username // password. - -$res = mysql_db_query("users", "select * from users", $link); +$link = mysql_connect('localhost', $user, "secret"); +mysql_select_db($dbname, $link) + or die("Could not set $dbname"); +$res = mysql_query("select * from users", $link); echo mysql_field_name($res, 0) . "\n"; echo mysql_field_name($res, 2); @@ -1353,20 +1414,20 @@ password "; echo "The table has the following fields
"; while ($i < $fields) { - $type = mysql_field_type ($result, $i); - $name = mysql_field_name ($result, $i); - $len = mysql_field_len ($result, $i); - $flags = mysql_field_flags ($result, $i); + $type = mysql_field_type($result, $i); + $name = mysql_field_name($result, $i); + $len = mysql_field_len($result, $i); + $flags = mysql_field_flags($result, $i); echo $type." ".$name." ".$len." ".$flags."
"; $i++; } @@ -1864,8 +1925,8 @@ echo "$num_rows Rows\n"; ]]> @@ -1881,8 +1942,8 @@ $result = mysql_query ("SELECT * WHERE 1=1") ]]> @@ -1914,7 +1975,6 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") See also: mysql_num_rows mysql_affected_rows, - mysql_db_query, mysql_unbuffered_query, mysql_free_result, mysql_fetch_array, @@ -2094,11 +2154,11 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") "; $i++; }