From e04ff2fbcdebfe5cff791f77ec7881ef10c9337d Mon Sep 17 00:00:00 2001 From: Kontra Gergely Date: Thu, 30 Aug 2001 16:35:09 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@56304 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/mysql.xml | 1649 +++++++++++++++++++------------------------ 1 file changed, 708 insertions(+), 941 deletions(-) diff --git a/functions/mysql.xml b/functions/mysql.xml index 0449af283f..f926ce7a5a 100644 --- a/functions/mysql.xml +++ b/functions/mysql.xml @@ -1,79 +1,44 @@ - - + - MySQL functions + MySQL függvények MySQL - These functions allow you to access MySQL database servers. In - order to have these functions available, you must compile php - with MySQL support by using the - option. If you - use this option without specifying the path to MySQL, php will - use the built-in MySQL client libraries. Users who run other - applications that use MySQL (for example, running php3 and php4 - as concurrent apache modules, or auth-mysql) should always - specify the path to MySQL: - . - This will force php to use the client libraries installed by - MySQL, avoiding any conflicts. + E függvények segítségével érheted el a MySQL adatbázisokat. Ahhoz, hogy + ezeket a függvényeket használhasd, a php-t a + opcióval kell lefordítanod. + Ha nem adod meg az opció után a mysql elérési útvonalát, akkor a php a + beépített mysql kliens könyvtárat fogja használni. Ha a felhasználók más + alkalmazásokat is használnak, amelyek mysql-t használnak (például a php + 3-as és 4-es verzióját, vagy az auth-mysql-t), akkor mindig meg kell adni + a mysql elérési útvonalát a + formában. + Ez ki fogja kényszeríteni, hogy a meglévő mysql kliens könyvtárat + használja a php, elkerülve az ebből adódó ütközéseket. - More information about MySQL can be found at &url.mysql;. + A MySQL-ről további információt a + &url.mysql; címen találsz. - Documentation for MySQL can be found at &url.mysql.docs;. - - This simple example shows how to connect, execute a query, print - resulting rows and disconnect from MySQL Database. - - MySQL extension overview example - -<?php - $link = mysql_connect("mysql_host", "mysql_login", "mysql_password") - or die ("Could not connect"); - print ("Connected successfully"); - mysql_select_db ("my_database") - or die ("Could not select database"); - - $query = "SELECT * FROM my_table"; - $result = mysql_query ($query) - or die ("Query failed"); - // printing HTML result - - print "<table>\n"; - while($line = mysql_fetch_array($result)){ - print "\t<tr>\n"; - while(list($col_name, $col_value) = each($line)){ - print "\t\t<td>$col_value</td>\n"; - } - print "\t</tr>\n"; - } - print "</table>\n"; - - mysql_close($link); -?> - - - mysql_affected_rows - Get number of affected rows in previous MySQL - operation + Az előző MySQL műveletben érintett sorok számát adja + meg - Description + Leírás int mysql_affected_rows - resource + int link_identifier @@ -81,44 +46,31 @@ - mysql_affected_rows returns the number - of rows affected by the last INSERT, UPDATE or DELETE query - associated with link_identifier. If the - link identifier isn't specified, the last link opened by - mysql_connect is assumed. + A mysql_affected_rows függvény az előző + link_identifier-rel azonosított kapcsolatban kiadott INSERT, + UPDATE vagy DELETE kérésben érintett sorok számát adja vissza. + Ha nem adsz meg kapcsolat-azonosítót, akkor az utoljára megnyitott + kapcsolatról kapsz információt. - If you are using transactions, you need to call - mysql_affected_rows after your INSERT, - UPDATE, or DELETE query, not after the commit. + Ha transzakciókezelést hasznnálsz, akkor a + mysql_affected_rows függvényt az INSERT, UPDATE, + vagy DELETE kérés után közvetlenül, nem a kommit után kell meghívni. - If the last query was a DELETE query with no WHERE clause, all - of the records will have been deleted from the table but this - function will return zero. - - - - When using UPDATE, MySQL will not update columns where the new - value is the same as the old value. This creates the possiblity - that mysql_affected_rows may not actually - equal the number of rows matched, only the number of rows that - were literally affected by the query. - - - - mysql_affected_rows does not work with - SELECT statements; only on statements which modify records. To - retrieve the number of rows returned by a SELECT, use - mysql_num_rows. + Ha az utolsó lekérdezés egy WHERE feltétel nélküli DELETE volt, akkor bár + a táblából minden sor törlődik, a függvény nullát fog visszaadni. - If the last query failed, this function will return -1. + Ez a parancs nem hatékony a lekérdező SELECT kéréssel együtt használva, + csak azokkal a lekérdezésekkel, melyek módosítják a táblázat sorait. + Ha egy SELECT lekérdezésben kapott sorok számát szeretnéd megkapni, + akkor használd a mysql_num_rows függvényt. - See also: mysql_num_rows. + Ha az utolsó kérés meghiusul, akkor a függvény -1-gyel tér vissza. @@ -127,11 +79,11 @@ mysql_change_user - Change logged in user of the active connection + Aktív kapcsolat felhasználójának módosítása - Description + Leírás int mysql_change_user @@ -142,7 +94,7 @@ database - resource + int link_identifier @@ -150,17 +102,13 @@ - mysql_change_user changes the logged in user - of the current active connection, or the connection given by the - optional parameter link_identifier. If a database is - specified, this will default or current database after the user - has been changed. If the new user and password authorization fails, - the current connected user stays active. - - - - This function was introduced in PHP 3.0.13 and - requires MySQL 3.23.3 or higher. + A mysql_change_user függvény megváltoztatja az + aktuális, vagy az opcionális paraméterben megadott azonosítójú kapcsolat + felhasználóját. Ha egy adatbázis nevét megadod, akkor ez lesz az + alapértelmezett adatbázis. Ha az új név-jelszó páros helytelen, akkor a + függvényhívás előtti kapcsolat él tovább. + A függvény a PHP 3.0.13 változatával került a nyelvbe és + MySQL 3.23.3, vagy későbbi változata szükséges a használatához. @@ -168,14 +116,14 @@ mysql_close - Close MySQL connection + Lezár egy MySQL kapcsolatot - Description + Leírás - bool mysql_close - resource + int mysql_close + int link_identifier @@ -183,40 +131,38 @@ - Returns: &true; on success, &false; on error. + A függvény értéke igaz, ha a művelet sikerült, hamis, ha nem. - mysql_close closes the connection to - the MySQL server that's associated with the specified link - identifier. If link_identifier isn't - specified, the last opened link is used. + A mysql_close függvény bezárja az adott + azonosítójú MySQL kapcsolatot. Ha nem adsz meg + link_identifier paramétert, akkor az utoljára + megnyitott kapcsolatot zárja le. - Using mysql_close isn't usually necessary, - as non-persistent open links are automatically closed at the end - of the script's execution. See also - freeing - resources. + A mysql_close függvény használata általában + szükségtelen, mert a nem perzisztens kapcsolatok a szkript végén + bezáródnak. - mysql_close will not close persistent links - created by mysql_pconnect. + A mysql_close függvény nem zárja be a + mysql_pconnect függvénnyel megnyitott kapcsolatokat. - MySQL close example + MySQL close példa <?php - $link = mysql_connect ("kraemer", "marliesle", "secret") - or die ("Could not connect"); - print ("Connected successfully"); + $link = mysql_connect ("kraemer", "marliesle", "titok") + or die ("Nem lehet csatlakozni"); + print ("A csatlakozás sikerült"); mysql_close ($link); ?> - See also: mysql_connect, and - mysql_pconnect. + Lásd még a mysql_connect és a + mysql_pconnect függvényeket! @@ -224,13 +170,13 @@ mysql_connect - Open a connection to a MySQL Server + Kapcsolatot nyit meg egy MySQL szerverhez - Description + Leírás - resource mysql_connect + int mysql_connect string hostname @@ -252,61 +198,60 @@ - Returns a MySQL link identifier on success, or &false; on failure. + Pozitív MySQL azonosítóval tér vissza, ha a csatlakozás sikerült. Hiba + esetén pedig hibaüzenetet ír a kimenetre és 0-val tér vissza. - mysql_connect establishes a connection - to a MySQL server. The following defaults are assumed for - missing optional parameters: host:port = - 'localhost:3306', username = name of the - user that owns the server process and - password = empty password. + A mysql_connect függvény kapcsolatot nyit meg egy + MySQL szerverhez. A paramétereket elhagyhatod. Az alapértelmezett + értékek: host:port = 'localhost:3306', + username = a folyamat tulajdonosának belépési neve + password = üres karakterlánc. - The hostname string can also include a port - number. eg. "hostname:port" or a path to a socket - eg. ":/path/to/socket" for the localhost. + A hostname paraméter tartalmazhat egy portszámot is, például: + "hostname:port" vagy tartalmazhatja a MySQL socket elérési + útvonalát, például: ":/path/to/socket". Az utóbbi hostname + paramétert használva is a helyi MySQL szerverhez próbál majd kapcsolódni + a függvény. - Support for ":port" was added in PHP 3.0B4. + A ":port" formátumú kiegészítés a PHP 3.0B4-es változatában + került a nyelvbe. - Support for ":/path/to/socket" was added in - PHP 3.0.10. + A ":/path/to/socket" formát pedig a PHP 3.0.10-es verziójától + kezdve használhatjuk. - You can suppress the error message on failure by prepending '@' - to the function name. + A sikertelen kapcsolatkor kiírt hibaüzenetet elnyomhatod, ha '@' jelet + írsz a függvény elé. - If a second call is made to mysql_connect - with the same arguments, no new link will be established, but - instead, the link identifier of the already opened link will be - returned. + Ha a mysql_connect függvényt kétszer ugyanazokkal a + paraméterekkel hívod meg, akkor nem jön létre újabb kapcsolat; a függvény + a már meglévő kapcsolat azonosítóját fogja visszaadni. - The link to the server will be closed as soon as the execution of - the script ends, unless it's closed earlier by explicitly calling - mysql_close. + A kapcsolat a PHP program végén bezárul, ha előbb nem zártuk volna le a + mysql_close függvénnyel. - MySQL connect example + MySQL connect példa <?php - - $link = mysql_connect ("localhost", "username", "secret") - or die ("Could not connect"); - print ("Connected successfully"); + $link = mysql_connect ("kraemer", "marliesle", "titok") + or die ("Nem lehet csatlakozni"); + print ("A csatlakozás sikerült"); mysql_close ($link); - ?> - See also - mysql_pconnect, and - mysql_close. + Lásd még a + mysql_pconnect és + mysql_close függvényeket. @@ -314,15 +259,15 @@ mysql_create_db - Create a MySQL database + Létrehoz egy MySQL adatbázist - Description + Leírás int mysql_create_db string database name - resource + int link_identifier @@ -330,31 +275,29 @@ - mysql_create_db attempts to create a new - database on the server associated with the specified link - identifier. + A mysql_create_db függvény megkísérel létrehozni egy + új adatbázist a megadott kapcsolatazonosítón keresztül. - - MySQL create database example + MySQL 'create database' példa <?php $link = mysql_pconnect ("kron", "jutta", "geheim") - or die ("Could not connect"); + or die ("Nem lehet csatlakozni") if (mysql_create_db ("my_db")) { - print ("Database created successfully\n"); + print ("Az adatbázist létrehoztam\n"); } else { - printf ("Error creating database: %s\n", mysql_error ()); + printf ("Hiba az adatbázis létrehozásakor: %s\n", mysql_error ()); } ?> - For downwards compatibility mysql_createdb - can also be used. + Kompatíbilitási okokból a mysql_createdb függvény is + használható. - See also: mysql_drop_db. + Lásd még a: mysql_drop_db függvényt. @@ -362,59 +305,60 @@ mysql_data_seek - Move internal result pointer + Belső eredménymutató mozgatása - Description + Leírás - bool mysql_data_seek - resource result_identifier + int mysql_data_seek + int result_identifier int row_number - Returns: &true; on success, &false; on failure. + Igazzal tér vissza, ha a művelet sikerült - mysql_data_seek moves the internal row - pointer of the MySQL result associated with the specified result - identifier to point to the specified row number. The next call - to mysql_fetch_row would return that row. + A mysql_data_seek függvény az adott azonosítójú + ereményhalmazban ugrik a megadott pozícióra. + A mysql_fetch_row függvény következő hívásakor ezt a + sorszámú sort kapod meg. - Row_number starts at 0. + Ha az első sorra akarsz pozicionálni, akkor + Row_number 0 legyen! - MySQL data seek example + MySQL data seek példa <?php $link = mysql_pconnect ("kron", "jutta", "geheim") - or die ("Could not connect"); + or die ("Nem tudok csatlakozni"); mysql_select_db ("samp_db") - or die ("Could not select database"); + or die ("Nem tudok belépni az adatbázisba"); $query = "SELECT last_name, first_name FROM friends"; - $result = mysql_query ($query) - or die ("Query failed"); + $eredmeny = mysql_query ($query) + or die ("Rossz kérés"); # 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"; + for ($i = mysql_num_rows ($eredmeny) - 1; $i >=0; $i--) { + if (!mysql_data_seek ($eredmeny, $i)) { + printf ("Nem tudok a %d. sorra ugorni\n", $i); continue; } - if(!($row = mysql_fetch_object ($result))) + if(!($sor = mysql_fetch_object ($eredmeny))) continue; - echo ("$row->last_name $row->first_name<BR>\n"; + printf ("%s %s<BR>\n", $sor->last_name, $sor->first_name); } - mysql_free_result ($result); + mysql_free_result ($eredmeny); ?> @@ -427,11 +371,11 @@ Get result data - Description + Leírás - string mysql_db_name - resource result + int mysql_db_name + int result int row mixed @@ -441,27 +385,26 @@ - mysql_db_name takes as its first parameter - the result pointer from a call to - mysql_list_dbs. The - row parameter is an index into the result - set. + A mysql_db_name függvény első paramétere egy + mysql_list_dbs által visszaadott érték. A + row paraméter az eredményhalmaz indexe. - If an error occurs, &false; is returned. Use - mysql_errno and - mysql_error to determine the nature of the - error. + Ha hiba történt, a függvény FALSE-szal tér vissza. + Használd a + mysql_errno és a + mysql_error függvényeket a hiba eredetének + megállapítására! - <function>mysql_db_name</function> example + <function>Mysql_db_name</function> példa <?php error_reporting(E_ALL); -mysql_connect('dbhost', 'username', 'password'); +mysql_connect('dbhost', 'név', 'jelszó'); $db_list = mysql_list_dbs(); $i = 0; @@ -475,8 +418,8 @@ while ($i < $cnt) { - For backward compatibility, mysql_dbname is - also accepted. This is deprecated, however. + Kompatíbilitási okokból a mysql_dbname függvény is + használható, de használata nem javasolt. @@ -485,16 +428,16 @@ while ($i < $cnt) { mysql_db_query - Send a MySQL query + MySQL kérést küld az adatbázisnak - Description + Leírás - resource mysql_db_query + int mysql_db_query string database string query - resource + int link_identifier @@ -502,29 +445,22 @@ while ($i < $cnt) { - Returns: A positive MySQL result resource to the query result, - or &false; on error. + Visszatérési értéke egy pozitív MySQL eredmény-azonosító, ha a kérés + sikeres volt, hamissal, ha a kérés hibás volt. - mysql_db_query selects a database and - executes a query on it. If the optional link identifier isn't - specified, the function will try to find an open link to the - MySQL server and if no such link is found it'll try to create one - as if mysql_connect was called with no - arguments + A mysql_db_query függvény kiválaszt egy adatbázist, + majd azon végrehajt egy kérést. Ha a kapcsolat azonosító nincs megadva, + akkor a függvény keres egyet. Ha nem talál ilyet, akkor megpróbál + létrehozni egyet oly módon, mintha meghívta volna a + mysql_connect függvényt paraméterek nélkül. - See also mysql_connect and - mysql_query. + Lásd még a mysql_connect függvényt. - - - This function has been deprecated since PHP 4.0.6. - Do not use this function. Use mysql_select_db - and mysql_query instead. - - + Kompatíbilitási okokból a mysql függvény is + használható. @@ -532,15 +468,15 @@ while ($i < $cnt) { mysql_drop_db - Drop (delete) a MySQL database + Töröl egy MySQL adatbázist - Description + Leírás - bool mysql_drop_db + int mysql_drop_db string database_name - resource + int link_identifier @@ -548,16 +484,16 @@ while ($i < $cnt) { - Returns: &true; on success, &false; on failure. + Visszatérési értéke: igaz, ha sikeres, hamis, ha nem - mysql_drop_db attempts to drop (remove) an - entire database from the server associated with the specified - link identifier. + A mysql_drop_db függvény megpróbálja az egész + adatbázist kitörölni, melyet az adott kapcsolat-azonosító határoz meg. - See also: mysql_create_db. For downward - compatibility mysql_dropdb can also be used. + Lásd még a mysql_create_db függvényt. + Kompatíbilitási okokból mysql_dropdb néven is + hívható a függvény. [és hallgat is a nevére] @@ -565,15 +501,14 @@ while ($i < $cnt) { mysql_errno - Returns the numerical value of the error message from previous - MySQL operation + Az előző MySQL művelet hibakódját tartalmazza - Description + Leírás int mysql_errno - resource + int link_identifier @@ -581,18 +516,20 @@ while ($i < $cnt) { - Returns the error number from the last MySQL function, or - 0 (zero) if no error occurred. + Az utoljára végrehajtott MySQL hiba kódjával tér vissza, vagy ha az + sikeres volt, akkor 0-t (nullát) ad vissza. - Errors coming back from the MySQL database backend no longer - issue warnings. Instead, use mysql_errno to - retrieve the error code. Note that this function only returns the - error code from the most recently executed MySQL function (not - including mysql_error and - mysql_errno), so if you want to use it, - make sure you check the value before calling another mySQL - function. + A MySQL hibái már nem jelennek meg figyelmeztetésként. [orig.: + Errors coming back from the mySQL database backend no longer + issue warnings.] + Ha szeretnéd megkapni a hiba kódját, használd a + mysql_errno függvényt! + Ez a függvény csak az utolsó MySQL művelet hibakódját adja vissza + [(not including mysql_error and + mysql_errno)], ha használni szeretnéd, ügyelj rá, + hogy még azelőtt hívd meg a függvényt, mielőtt egy másik MySQL függvényt + meghívsz. <?php @@ -607,7 +544,7 @@ echo mysql_errno().": ".mysql_error()."<BR>"; - See also: mysql_error + Lásd még a mysql_error függvényt @@ -615,15 +552,14 @@ echo mysql_errno().": ".mysql_error()."<BR>"; mysql_error - Returns the text of the error message from previous - MySQL operation + Az előző MySQL művelet hibaszövegét adja - Description + Leírás string mysql_error - resource + int link_identifier @@ -631,17 +567,20 @@ echo mysql_errno().": ".mysql_error()."<BR>"; - Returns the error text from the last MySQL function, or - '' (the empty string) if no error occurred. + Az utolsó MySQL művelet hibaszövegével tér vissza, vagy + '' (üres karakterlánccal) ha nem volt hiba. - Errors coming back from the MySQL database backend no longer - issue warnings. Instead, use mysql_error to - retrieve the error text. Note that this function only returns the - error text from the most recently executed MySQL function (not - including mysql_error and - mysql_errno), so if you want to use it, make - sure you check the value before calling another MySQL function. + A MySQL hibái már nem jelennek meg figyelmeztetésként. [orig.: + Errors coming back from the mySQL database backend no longer + issue warnings.] + Ha szeretnéd megkapni a hiba kódját, használd a + mysql_error függvényt! + Ez a függvény csak az utolsó MySQL művelet hibakódját adja vissza + [(not including mysql_error and + mysql_errno)], ha használni szeretnéd, ügyelj rá, + hogy még azelőtt hívd meg a függvényt, mielőtt egy másik MySQL függvényt + meghívsz. <?php @@ -656,52 +595,24 @@ echo mysql_errno().": ".mysql_error()."<BR>"; - See also: mysql_errno + Lásd még a mysql_errno függvényt! - - - mysql_escape_string - - Escapes a string for use in a mysql_query. - - - - Description - - - string mysql_escape_string - string unescaped_string - - - - This function will escape the unescaped_string, - so that it is safe to place it in a mysql_query. - - - - mysql_escape_string does not escape % - and _. - - - - - mysql_fetch_array - Fetch a result row as an associative array, a numeric array, or both. + Kérés egy sorát adja vissza (tetszőleges) tömb formájában. - Description + Leírás array mysql_fetch_array - resource result + int result int result_type @@ -710,54 +621,54 @@ echo mysql_errno().": ".mysql_error()."<BR>"; - Returns an array that corresponds to the fetched row, or &false; - if there are no more rows. + Az eredmény következő sorával tér vissza tömb formájában, vagy hamissal, + ha már nincs több sor. - mysql_fetch_array is an extended version of - mysql_fetch_row. In addition to storing the - data in the numeric indices of the result array, it also stores - the data in associative indices, using the field names as keys. + A mysql_fetch_array függvény a + mysql_fetch_row függvény kiterjesztett változata. + Ráadásul az eredményt nem csak számokkal indexelt tömbbe írja, hanem + asszociatív tömbbe is, ahol a mező nevei a kulcsok. - If two or more columns of the result have the same field names, - the last column will take precedence. To access the other column(s) - of the same name, you must the numeric index of the column or - make an alias for the column. + Ha az eredmény több sorának ugyanaz a neve, akkor a később szereplő + oszlop marad meg. Ha szeretnéd az összes mezőt elérni ilyenkor is, akkor + számmal indexeld a tömböt, vagy az SQL parancsban kérj aliast az + oszlopra. -select t1.f1 as foo t2.f1 as bar from t1, t2 +select t1.f1 as ize t2.f1 as bigyo from t1, t2 - An important thing to note is that using - mysql_fetch_array is NOT significantly - slower than using mysql_fetch_row, while it - provides a significant added value. + Jó tudni, hogy a mysql_fetch_array függvény + használata NEM jelentősen lassabb a mysql_fetch_row + használatánál, de a kapott eredmény feldolgozása jóval kényelmesebb. - The optional second argument result_type - in mysql_fetch_array is a constant and can - take the following values: MYSQL_ASSOC, MYSQL_NUM, and - MYSQL_BOTH. (This feature was added in PHP 3.0.7) + A mysql_fetch_array függvény elhagyható + result_type paramétere a következő lehet: + MYSQL_ASSOC, MYSQL_NUM, vagy MYSQL_BOTH. + (Ez a lehetőség a PHP 3.0.7-es változatában került a nyelvbe.) - For further details, see also - mysql_fetch_row and mysql_fetch_assoc. + További részletekért olvasd még a + mysql_fetch_row és a + mysql_fetch_assoc függvényeket! - <function>mysql_fetch_array</function> example + <function>Mysql_fetch_array</function> <?php -mysql_connect ($host, $user, $password); -$result = mysql_db_query ("database","select user_id, fullname from table"); -while ($row = mysql_fetch_array ($result)) { - echo "user_id: ".$row["user_id"]."<br>\n"; - echo "user_id: ".$row[0]."<br>\n"; - echo "fullname: ".$row["fullname"]."<br>\n"; - echo "fullname: ".$row[1]."<br>\n"; +mysql_connect ($host, $felhasznalo, $jelszo); +$eredmeny = mysql_db_query ("adatbázis","select user_id, teljesnev from table"); +while ($sor = mysql_fetch_array ($eredmeny)) { + echo "user_id: ".$sor["user_id"]."<br>\n"; + echo "user_id: ".$sor[0]."<br>\n"; + echo "fullname: ".$sor["fullname"]."<br>\n"; + echo "fullname: ".$sor[1]."<br>\n"; } -mysql_free_result ($result); +mysql_free_result ($eredmeny); ?> @@ -768,74 +679,76 @@ mysql_free_result ($result); mysql_fetch_assoc - Fetch a result row as an associative array + Az eredmény egy sorát asszociatív tömbként adja vissza. - Description + Leírás array mysql_fetch_assoc - resource result + int result - Returns an associative array that corresponds to the fetched row, - or &false; if there are no more rows. + Az eredmény következő sorával, mint asszociatív tömbbel tér vissza, vagy + hamissal, ha nincs több sor. - mysql_fetch_assoc is equivalent to calling - mysql_fetch_array with MYSQL_ASSOC for the - optional second parameter. It only returns an associative array. - This is the way mysql_fetch_array originally - worked. If you need the numeric indices as well as the - associative, use mysql_fetch_array. + A mysql_fetch_assoc függvény hívásával ugyanazt + érjük el, mintha a mysql_fetch_array függvényt + hívtuk volna meg MYSQL_ASSOC második paraméterrel. Ez a függvény egy + tisztán asszociatív tömböt ad vissza. Eredetileg a + mysql_fetch_array függvény így működött. Ha a + számokkal indexelt elemekre is szükséged van, akkor használd a + mysql_fetch_array függvényt. - If two or more columns of the result have the same field names, - the last column will take precedence. To access the other column(s) - of the same name, you must use mysql_fetch_array and - have it return the numeric indices as well. + Ha az eredmény több sorának ugyanaz a neve, akkor a később szereplő + oszlop marad meg. Ha szeretnéd az összes mezőt elérni ilyenkor is, akkor + az SQL parancsban kérj aliast az oszlopra, vagy használd a + mysql_fetch_array függvényt úgy, hogy a számmal + indexelt elemeket is kéred. - An important thing to note is that using - mysql_fetch_assoc is NOT significantly - slower than using mysql_fetch_row, while it - provides a significant added value. + Jó tudni, hogy a mysql_fetch_assoc függvény + használata NEM jelentősen lassabb a mysql_fetch_row + használatánál, de a kapott eredmény feldolgozása jóval kényelmesebb. - For further details, see also - mysql_fetch_row and mysql_fetch_array. + További részletekért lásd még a + mysql_fetch_row és a + mysql_fetch_array függvényeket. - <function>mysql_fetch_assoc</function> + <function>Mysql_fetch_assoc</function> <?php -mysql_connect ($host, $user, $password); -$result = mysql_db_query ("database","select * from table"); -while ($row = mysql_fetch_assoc ($result)) { - echo $row["user_id"]; - echo $row["fullname"]; +mysql_connect ($host, $felhasznalo, $jelszo); +$eredmeny = mysql_db_query ("adatbázis","select * from table"); +while ($sor = mysql_fetch_assoc ($eredmeny)) { + echo $sor["user_id"]; + echo $sor["fullname"]; } -mysql_free_result ($result); +mysql_free_result ($eredmeny); ?> - + mysql_fetch_field - Get column information from a result and return as an object + Eredményhalmaz egy oszlopáról ad információt objektum formájában - Description + Leírás object mysql_fetch_field - resource result + int result int field_offset @@ -844,117 +757,118 @@ mysql_free_result ($result); - Returns an object containing field information. + Egy mezőinformációt tartalmazó objektummal tér vissza. - mysql_fetch_field can be used in order to - obtain information about fields in a certain query result. If - the field offset isn't specified, the next field that wasn't yet - retrieved by mysql_fetch_field is retrieved. + A mysql_fetch_field függvényt arra használhatod, + hogy az eredmény egy oszlopáról információt kaphass. Ha a mező sorszámát + nem adod meg, akkor a következő olyan oszlopról kapsz információt, + amelyre még nem hívtad meg a + mysql_fetch_field függvényt. - The properties of the object are: + Az objektum tulajdonságai: - name - column name + name - az oszlop neve - table - name of the table the column belongs to + table - a tábla neve, amelyhez az oszlop tartozik - max_length - maximum length of the column + max_length - az oszlop maximális hossza - not_null - 1 if the column cannot be &null; + not_null - értéke 1, ha az oszlop nem veheti fel a NULL értéket - primary_key - 1 if the column is a primary key + primary_key - értéke 1, ha az oszlop elsődleges kulcs - unique_key - 1 if the column is a unique key + unique_key - értéke 1, ha az oszlop egyszerű kulcs - multiple_key - 1 if the column is a non-unique key + multiple_key - értéke 1, ha az oszlop összetett kulcs része - numeric - 1 if the column is numeric + numeric - értéke 1, ha az oszlop szám - blob - 1 if the column is a BLOB + blob - értéke 1, ha az oszlop BLOB típusú - type - the type of the column + type - az oszlop típusa - unsigned - 1 if the column is unsigned + unsigned - értéke 1, ha az oszlop nem előjeles - zerofill - 1 if the column is zero-filled + zerofill - értéke 1, ha az oszlop nullával feltöltött - <function>mysql_fetch_field</function> + <function>Mysql_fetch_field</function> <?php -mysql_connect ($host, $user, $password) - or die ("Could not connect"); -$result = mysql_db_query ("database", "select * from table") - or die ("Query failed"); -# get column metadata +mysql_connect ($host, $felhasznalo, $jelszo) + or die ("Nem lehet csatlakozni az adatbázishoz"); +$eredmeny = mysql_db_query ("adatbázis", "select * from table") + or die ("Hibás kérés"); +# oszlopinformáció lekérése $i = 0; -while ($i < mysql_num_fields ($result)) { - echo "Information for column $i:<BR>\n"; - $meta = mysql_fetch_field ($result); +while ($i < mysql_num_fields ($eredmeny)) { + echo "Információ a $i. oszlopról:<BR>\n"; + $meta = mysql_fetch_field ($eredmeny); if (!$meta) { - echo "No information available<BR>\n"; + echo "Nem tudok információt lekérni<BR>gt;\n"; } - echo "<PRE> -blob: $meta->blob -max_length: $meta->max_length -multiple_key: $meta->multiple_key -name: $meta->name -not_null: $meta->not_null -numeric: $meta->numeric -primary_key: $meta->primary_key -table: $meta->table -type: $meta->type -unique_key: $meta->unique_key -unsigned: $meta->unsigned -zerofill: $meta->zerofill -</PRE>"; + echo "<PRE> +blob: $meta->blob +max_length: $meta->max_length +multiple_key: $meta->multiple_key +name: $meta->name +not_null: $meta->not_null +numeric: $meta->numeric +primary_key: $meta->primary_key +table: $meta->table +type: $meta->type +unique_key: $meta->unique_key +unsigned: $meta->unsigned +zerofill: $meta->zerofill +</PRE>"; $i++; } -mysql_free_result ($result); +mysql_free_result ($eredmeny); ?> - See also mysql_field_seek. + Lásd még a mysql_field_seek függvényt! @@ -963,32 +877,31 @@ mysql_free_result ($result); mysql_fetch_lengths - Get the length of each output in a result + Az eredmény oszlopainak hosszáról nyújt információt - Description + Leírás array mysql_fetch_lengths - resource result + int result - Returns: An array that corresponds to the lengths of each field - in the last row fetched by mysql_fetch_row, - or &false; on error. + Egy tömbbel tér vissza. A tömb elemei az utolsó + mysql_fetch_row függvény által betöltött oszlopok + hosszait tartalmazza, vagy hiba esetén hamisat. - mysql_fetch_lengths stores the lengths of - each result column in the last row returned by + A mysql_fetch_lengths függvény a mysql_fetch_row, - mysql_fetch_array, and - mysql_fetch_object in an array, starting at - offset 0. + mysql_fetch_array vagy a + mysql_fetch_object által betöltött sor hosszait adja + vissza számmal indexelt tömb formájában. - See also: mysql_fetch_row. + Lásd még a mysql_fetch_row függvényt! @@ -996,14 +909,15 @@ mysql_free_result ($result); mysql_fetch_object - Fetch a result row as an object + Az eredmény következő sorát objektum formájában adja + vissza - Description + Leírás object mysql_fetch_object - resource result + int result int result_type @@ -1012,44 +926,44 @@ mysql_free_result ($result); - Returns an object with properties that correspond to the fetched - row, or &false; if there are no more rows. + Egy objektummal tér vissza, amelynek tulajdonságai a betöltött sor + oszlopait tartalmazzák. Ha nincs több sor, a függvény hamisat ad + eredményül. - mysql_fetch_object is similar to - mysql_fetch_array, with one difference - an - object is returned, instead of an array. Indirectly, that means - that you can only access the data by the field names, and not by - their offsets (numbers are illegal property names). + A mysql_fetch_object függvény hasonló a + mysql_fetch_array függvényhez, egy különbséggel: nem + tömböt, hanem objektumot ad vissza a függvény. Ez azt jelenti, hogy a + mezőket csak a nevük alapján tudod elérni, mivel a számok nem + érvényes tulajdonságnevek. - The optional argument result_type is a - constant and can take the following values: MYSQL_ASSOC, - MYSQL_NUM, and MYSQL_BOTH. + Az elhagyható result_type parméter egy konstans, + ami MYSQL_ASSOC, MYSQL_NUM vagy MYSQL_BOTH lehet. - Speed-wise, the function is identical to - mysql_fetch_array, and almost as quick as - mysql_fetch_row (the difference is - insignificant). + Sebesség szempontjából a mysql_fetch_array + függvénnyel azonos sebességű és majdnem olyan gyors, mint a + mysql_fetch_row függvény (a különbség + elhanyagolható) - <function>mysql_fetch_object</function> example + <function>mysql_fetch_object</function> példa <?php -mysql_connect ($host, $user, $password); -$result = mysql_db_query ("database", "select * from table"); -while ($row = mysql_fetch_object ($result)) { - echo $row->user_id; - echo $row->fullname; +mysql_connect ($host, $felhasznalo, $jelszo); +$eredmeny = mysql_db_query ("adatbázis", "select * from table"); +while ($sor = mysql_fetch_object ($eredmeny)) { + echo $sor->user_id; + echo $sor->fullname; } -mysql_free_result ($result); +mysql_free_result ($eredmeny); ?> - See also: mysql_fetch_array and - mysql_fetch_row. + Lásd még a mysql_fetch_array és a + mysql_fetch_row függvényt! @@ -1057,37 +971,37 @@ mysql_free_result ($result); mysql_fetch_row - Get a result row as an enumerated array + Az eredmény következő sorát adja vissza számmal indexelt tömb + formájában - Description + Leírás array mysql_fetch_row - resource result + int result - Returns: An array that corresponds to the fetched row, or &false; - if there are no more rows. + Egy számmal indexelt tömbbel tér vissza, ami a betöltött sorokat + tartalmazza, vagy hamissal, ha nincs több sor. - mysql_fetch_row fetches one row of data from - the result associated with the specified result identifier. The - row is returned as an array. Each result column is stored in an - array offset, starting at offset 0. + A mysql_fetch_row függvény betölt egy sort a + megadott eredmény-azonosítójú eredményhalmazból. A sort (számmal + indexelt) tömb formájában adja vissza. Az oszlopok számozása 0-tól indul. - Subsequent call to mysql_fetch_row would - return the next row in the result set, or &false; if there are no - more rows. + A mysql_fetch_row többszöri alkamazásával végig + tudjuk járni az eredményhalmazt, mivel az mindig a következő sort tölti + be, majd ha elfogytak a sorok, hamisat ad vissza. - See also: mysql_fetch_array, + Lásd még a mysql_fetch_array, mysql_fetch_object, mysql_data_seek, - mysql_fetch_lengths, and - mysql_result. + mysql_fetch_lengths és a + mysql_result függvényeket! @@ -1096,32 +1010,32 @@ mysql_free_result ($result); mysql_field_flags - Get the flags associated with the specified field in a result + Adott eredmény adott mezejének flagjeit adja vissza. - Description + Leírás string mysql_field_flags - resource result + int result int field_offset - mysql_field_flags returns the field flags of - the specified field. The flags are reported as a single word - per flag separated by a single space, so that you can split the - returned value using explode. + A mysql_field_flags függvény az adott mező flagjeit + adja vissza. A flagek egyszerű szavak, melyeket egyetlen szóköz választ + el, így a kapott értéket feldolgozhatod a explode + függvény segítségével. - The following flags are reported, if your version of MySQL - is current enough to support them: "not_null", "primary_key", + A MySQL a következő flageket támogatja (feltéve, hogy elég friss a + használt MySQL, amit használsz): "not_null", "primary_key", "unique_key", "multiple_key", "blob", "unsigned", "zerofill", "binary", "enum", "auto_increment", "timestamp". - For downward compatibility mysql_fieldflags - can also be used. + Kompatíbilitási okokból a mysql_fieldflags függvény + is használható. @@ -1130,43 +1044,42 @@ mysql_free_result ($result); mysql_field_name - Get the name of the specified field in a result + Adott mező nevét adja vissza - Description + Leírás string mysql_field_name - resource result + int result int field_index - mysql_field_name returns the name of the - specified field index. result must be a - valid result identifier and field_index is - the numerical offset of the field. + A mysql_field_name függvény az eredményben szereplő + megadott indexű mező nevét adja vissza. A result + paraméternek érvényes eredményazonosítónak kell lennie, + a field_index paraméter pedig a mező indexe. - field_index starts at 0. + A field_index paraméter számozása 0-tól kezdődik. - e.g. The index of the third field would actually be 2, the index - of the fourth field would be 3 and so on. + Például a harmadik mező indexe 2, a negyedik mezőé pedig 3. - <function>mysql_field_name</function> example + <function>mysql_field_name</function> példa -// The users table consists of three fields: +// A felhasznalok tábla három mezőből áll: // user_id -// username -// password. +// felhasznalonev +// jelszo. -$res = mysql_db_query("users", "select * from users", $link); +$res = mysql_db_query("felhasznalok", "select * from felhasznalok", $link); echo mysql_field_name($res, 0) . "\n"; echo mysql_field_name($res, 2); @@ -1174,17 +1087,17 @@ echo mysql_field_name($res, 2); - The above example would produce the following output: + A fenti példa ay alábbi kimenetet eredményezi: user_id -password +jelszo - For downwards compatibility mysql_fieldname - can also be used. + Kompatíbilitási okokból a mysql_fieldname + függvény is használható. @@ -1193,25 +1106,25 @@ password mysql_field_len - Returns the length of the specified field + A kérdezett mező hosszát adja vissza - Description + Leírás int mysql_field_len - resource result + int result int field_offset - mysql_field_len returns the length of the - specified field. + A mysql_field_len függvény a kérdezett mező + hosszával tér vissza. - For downward compatibility mysql_fieldlen - can also be used. + Kompatíbilitási okokból a mysql_fieldlen + függvény is használható. @@ -1220,26 +1133,27 @@ password mysql_field_seek - Set result pointer to a specified field offset + Az eredménymutatót a kívánt pozícióba mozgatja - Description + Leírás int mysql_field_seek - resource result + int result int field_offset - Seeks to the specified field offset. If the next call to - mysql_fetch_field doesn't include a field - offset, the field offset specified in - mysql_field_seek will be returned. + A megadott helyre mozgatja az eredmény-mutatót. Ha a következő + mysql_fetch_field függvényhívás nem tartalmaz mező + pozíciót, akkor a + mysql_field_seek függvény által visszaadott + mezőpozíciót fogja visszaadni. - See also: mysql_fetch_field. + Lásd még a mysql_fetch_field függvényt! @@ -1248,25 +1162,25 @@ password mysql_field_table - Get name of the table the specified field is in + Visszaadja annak a táblának a nevét, melyben a megadott mező található - Description + Leírás string mysql_field_table - resource result + int result int field_offset - Returns the name of the table that the specifed field is - in. + A függvény annak a táblának a nevével tér vissza, melyben a megadott mező + szerepel. - For downward compatibility mysql_fieldtable - can also be used. + Kompatíbilitási okokból a mysql_fieldtable + függvény is használható. @@ -1275,56 +1189,56 @@ password mysql_field_type - Get the type of the specified field in a result + Az eredmény adott mezejének típusát adja vissza - Description + Leírás string mysql_field_type - iresource result + int result int field_offset - mysql_field_type is similar to the - mysql_field_name function. The arguments are - identical, but the field type is returned instead. The field type - will be one of "int", "real", "string", "blob", and others as - detailed in the MySQL - documentation. + A mysql_field_type függvény hasonló a + mysql_field_name függvényhez. A paraméterek + megegyeznek, de a függvény a mező típusával tér vissza. A mezőtípus az + "int", "real", "string", "blob" vagy hasonló, a + MySQL dokumentációban található + típusok közül való. - MySQL field types + mysql mezőtípusok <?php mysql_connect ("localhost:3306"); mysql_select_db ("wisconsin"); -$result = mysql_query ("SELECT * FROM onek"); -$fields = mysql_num_fields ($result); -$rows = mysql_num_rows ($result); +$eredmeny = mysql_query ("SELECT * FROM onek"); +$mezo = mysql_num_fields ($eredmeny); +$sor = mysql_num_rows ($eredmeny); $i = 0; -$table = mysql_field_table ($result, $i); -echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>"; -echo "The table has the following fields <BR>"; -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); - echo $type." ".$name." ".$len." ".$flags."<BR>"; +$table = mysql_field_table ($eredmeny, $i); +echo "A '$table' nevű táblának $mezo mezője és $sor sora van <BR>"; +echo "A táblának az alábbi mezői vannak<BR>"; +while ($i < $mezo) { + $tipus = mysql_field_type ($eredmeny, $i); + $nev = mysql_field_name ($eredmeny, $i); + $hossz = mysql_field_hossz ($eredmeny, $i); + $flags = mysql_field_flags ($eredmeny, $i); + echo "$tipus $nev $hossz $flags."<BR>"; $i++; } mysql_close(); -?> +?> - For downward compatibility mysql_fieldtype - can also be used. + Kompatíbilitási okokból a mysql_fieldtype + függvény is használható. @@ -1332,31 +1246,29 @@ mysql_close(); mysql_free_result - Free result memory + Felszabadítja az eredmény által lefoglalt memóriát - Description + Leírás int mysql_free_result - resource result + int result - mysql_free_result will free all memory - associated with the result identifier result. + A mysql_free_result függvény az összes + result eredményazonosító által használt memóriát + felszabadítja. - mysql_free_result only needs to be called if - you are concerned about how much memory is being used for queries - that return large result sets. All associated result memory is - automatically freed at the end of the script's execution. - + A mysql_free_result függvényt csak akkor kell + meghívnod, ha nagyon aggódsz a használt memória mennyisége miatt. A + memória a php program végén úgyis felszabadul. - - For downward compatibility mysql_freeresult - can also be used. + Kompatíbilitási okokból a mysql_freeresult + függvény is használható. @@ -1365,15 +1277,16 @@ mysql_close(); mysql_insert_id + Visszaadja az előző INSERT művelet által előállított id-t adja vissza. Get the id generated from the previous INSERT operation - Description + Leírás int mysql_insert_id - resource + int link_identifier @@ -1381,36 +1294,35 @@ mysql_close(); - mysql_insert_id returns the ID generated for - an AUTO_INCREMENT column by the previous INSERT query using the - given link_identifier. If - link_identifier isn't specified, the last - opened link is assumed. + A mysql_insert_id függvény az előző INSERT + műveletben szereplő AUTO_INCREMENT tulajdonságú mező értékét adja vissza. + Ha megadjuk link_identifier-t az adott + linkkel rendelekező, ha nem adunk meg paramétert, az utolsó megnyitott + linkhez tartozó eredményt szolgáltatja. - mysql_insert_id returns 0 if the previous - query does not generate an AUTO_INCREMENT value. If you need to - save the value for later, be sure to call mysql_insert_id() - immediately after the query that generates the value. + A mysql_insert_id függvény 0-val tér vissza, ha az + előző kérésben nem jött létre AUTO_INCREMENT érték. Ha szükséged van + később az értékre, hívd meg a mysql_insert_id + függvényt rögtön az értéket generáló lekérdezés után! - The value of the MySQL SQL function - LAST_INSERT_ID() always contains the most - recently generated AUTO_INCREMENT value, and is not reset - between queries. + A LAST_INSERT_ID() függvény értéke mindig az utoljára + előállított AUTO_INCREMENT értéket tartalmazza, nem törlődik az értéke + lekérdezések között. - mysql_insert_id converts the return type of - the native MySQL C API function - mysql_insert_id() to a type of - long. If your AUTO_INCREMENT column has - a column type of BIGINT, the value returned by - mysql_insert_id will be incorrect. - Instead, use the internal MySQL SQL function - LAST_INSERT_ID(). + A mysql_insert_id függvény a MySQL C API függvény + mysql_insert_id() visszatérési értékét + long-gá konvertálja. Ha az AUTO_INCREMENT meződ + mondjuk BIGINT típusú, akkor a + mysql_insert_id függvény rossz eredményt adhat + vissza. Ezért inkább a belső + LAST_INSERT_ID() MySQL függvényt használd! @@ -1420,15 +1332,15 @@ mysql_close(); mysql_list_dbs - List databases available on a MySQL server + Kilistázza a MySQL szerveren elérhető adatbázisokat - Description + Leírás - resource mysql_list_dbs - resource + int mysql_list_dbs + int link_identifier @@ -1436,62 +1348,62 @@ mysql_close(); - mysql_list_dbs will return a result pointer - containing the databases available from the current mysql - daemon. Use the mysql_tablename function to - traverse this result pointer. + A mysql_list_dbs függvény egy eredménymutatót ad + vissza, ami a mysql démontól elérhető adatbázisokat tartalmazza. + Használd a mysql_tablename függvényt, hogy az összes + táblát elérd! - <function>mysql_list_dbs</function> example + <function>mysql_list_dbs</function> példa -$link = mysql_connect('localhost', 'myname', 'secret'); +$link = mysql_connect('localhost', 'nevem', 'titok'); $db_list = mysql_list_dbs($link); -while ($row = mysql_fetch_object($db_list)) { - echo $row->Database . "\n"; +while ($sor = mysql_fetch_object($db_list)) { + echo $sor->Database . "\n"; } - The above example would produce the following output: + A fenti példa az alábbi kimenetet eredményezi. -database1 -database2 -database3 +adatbázis1 +adatbázis2 +adatbázis3 ... - The above code would just as easily work with - mysql_fetch_row or other similar functions. + A fenti program egyszerűen bővíthető a + mysql_fetch_row függvénnyel vagy más hasonló + függvénnyel. - For downward compatibility mysql_listdbs can - also be used. + Kompatíbilitási okokból a mysql_listdbs függvény + is használható. - See also mysql_db_name mysql_list_fields - List MySQL result fields + Kilistázza a MySQL eredmény mezőit - Description + Leírás - resource mysql_list_fields + int mysql_list_fields string database_name string table_name - resource + int link_identifier @@ -1499,72 +1411,67 @@ database3 - mysql_list_fields retrieves information - about the given tablename. Arguments are the database name and - the table name. A result pointer is returned which can be used - with mysql_field_flags, + A mysql_list_fields függvény az adott tábláról + szolgáltat információt. A paraméterek az adatbázis és a tábla neve. A + függvény egy eredmény-azonosító tér vissza, amit a + mysql_field_flags, mysql_field_len, - mysql_field_name, and - mysql_field_type. + mysql_field_name, és a + mysql_field_type függvényekkel hámozhatsz meg. - + Az eredmény-azonosító egy pozitív egész szám. A függvény hiba esetén + -1-gyel tér vissza. A hiba szöveges leírása a + $phperrmsg változóban található, és ha nem + @mysql() <- így hívtad meg a függvényt, akkor a + hiba kiírásra kerül [már ha nem pl. egy Javascript kód belsejében, vagy + egy keretrendszer tetején akarná kiírni szegény PHP...]. + - <function>mysql_list_fields</function> example + <function>mysql_list_fields</function> példa -$link = mysql_connect('localhost', 'myname', 'secret'); +$link = mysql_connect('localhost', 'nevem', 'titok'); -$fields = mysql_list_fields("database1", "table1", $link); -$columns = mysql_num_fields($fields); +$mezo = mysql_list_fields("adatbázis1", "tabla1", $link); +$oszlop = mysql_num_fields($mezo); -for ($i = 0; $i < $columns; $i++) { - echo mysql_field_name($fields, $i) . "\n";; +for ($i = 0; $i < $oszlop; $i++) { + echo mysql_field_name($mezo, $i) . "\n";; } - The above example would produce the following output: + A fenti példa az alábbi kimenetet eredményezi: -field1 -field2 -field3 +mezo1 +mezo2 +mezo3 ... - For downward compatibility mysql_listfields - can also be used. + Kompatíbilitási okokból a mysql_listfields + függvény is használható. - mysql_list_tables - List tables in a MySQL database + Adott adatbázisbeli táblaneveket listázza - Description + Leírás - resource mysql_list_tables + int mysql_list_tables string database - resource + int link_identifier @@ -1572,15 +1479,15 @@ field3 - mysql_list_tables takes a database name and - returns a result pointer much like the - mysql_db_query function. The - mysql_tablename function should be used to - extract the actual table names from the result pointer. + A mysql_list_tables függvény veszi az + adatbázisnevet, és egy eredmény-mutatót ad vissza, a + mysql_db_query függvényhez hasonlóan. A + mysql_tablename függvény használható arra, hogy az + eredmény-mutatóból a tényleges táblaneveket megállapítsd. - For downward compatibility mysql_listtables - can also be used. + Kompatíbilitási okokból a mysql_listtables + függvény is használható. @@ -1588,29 +1495,29 @@ field3 mysql_num_fields - Get number of fields in result + Az eredményben szereplő mezők számát adja - Description + Leírás int mysql_num_fields - resource result + int result - mysql_num_fields returns the number of - fields in a result set. + A mysql_num_fields függvény az eredményhalmazban + levő mezők számát adja vissza. - See also: + Lásd még a mysql_db_query, mysql_query, - mysql_fetch_field, - mysql_num_rows. + mysql_fetch_field és a + mysql_num_rows függvényeket! - For downward compatibility mysql_numfields - can also be used. + Kompatíbilitási okokból a mysql_numfields + függvény is használható. @@ -1618,47 +1525,47 @@ field3 mysql_num_rows - Get number of rows in result + Az eredményben szereplő sorok számát adja vissza. - Description + Leírás int mysql_num_rows - resource result + int result - mysql_num_rows returns the number of rows in - a result set. This command is only valid for SELECT statements. - To retrieve the number of rows returned from a INSERT, UPDATE or - DELETE query, use mysql_affected_rows. + A mysql_num_rows függvény az eredményhalmazban + szereplő sorok számát adja vissza. A függvény csak SELECT kérésre + használható. Ha egy INSERT, UPDATE vagy DELETE kérésben érintett sorok + számát szeretnéd megtudni, használd a + DELETE, use mysql_affected_rows függvényt! - <function>mysql_num_rows</function> example + + <function> + mysql_num_rows példa Szerző: crubel@trilizio.org + </function> + <?php - -$link = mysql_connect("localhost", "username", "password"); -mysql_select_db("database", $link); - -$result = mysql_query("SELECT * FROM table1", $link); -$num_rows = mysql_num_rows($result); - -echo "$num_rows Rows\n"; - -?> +$conn = mysql_connect("hostcim", "juzer", "jelszo"); +mysql_select_db("adatbázis",$conn); // kell, ha több adatbázis van +$Eredmenytagokszama = mysql_query("SELECT * FROM Szamla",$conn); +$Tagokszama = mysql_num_rows($Eredmenytagokszama); +echo "$Tagokszama tag van"; +?> - See also: - mysql_affected_rows, - mysql_connect, - mysql_select_db and - mysql_query. + Lásd még a + mysql_db_query, + mysql_query és a + mysql_fetch_row függvényeket! - For downward compatibility mysql_numrows can + Kompatíbilitási okokból a mysql_numrows can also be used. @@ -1668,14 +1575,14 @@ echo "$num_rows Rows\n"; mysql_pconnect - Open a persistent connection to a MySQL Server + Perzisztens kapcsolatot nyit meg a MySQL szerverhez - Description + Leírás - resource mysql_pconnect + int mysql_pconnect string hostname @@ -1693,51 +1600,52 @@ echo "$num_rows Rows\n"; - Returns: A positive MySQL persistent link identifier on success, - or &false; on error. + Visszatérési értéke: Egy pozitív MySQL perzisztens kapcsolatazonosító + siker esetén, vagy false, ha hiba történt. - mysql_pconnect establishes a connection - to a MySQL server. The following defaults are assumed for - missing optional parameters: host:port = - 'localhost:3306', username = name of the - user that owns the server process and - password = empty password. + A mysql_pconnect függvény létrehoz egy kapcsolatot a + MySQL szerverhez. Az elhagyott paraméterek az alábbi értékeket veszik + fel: + host:port = + 'localhost:3306', username = annak a + felhasználónak a neve, akié a szerver folyamat és végül: + password = üres jelszó. - The hostname string can also include a port - number. eg. "hostname:port" or a path to a socket - eg. ":/path/to/socket" for the localhost. + A hostname karakterlánc a port számát is + tartalmazhatja; pl.: "hostname:port" vagy a socket teljes + elérési útvonalát pl.: ":/path/to/socket". Ez persze csak a + helyi gépen működik. - Support for ":port" was added in 3.0B4. + A ":port" használata a 3.0B4-es verzió óta lehetséges. - Support for the ":/path/to/socket" was added in - 3.0.10. + A ":/path/to/socket" forma használata a 3.0.10-es verzió óta + támogatott. - - - mysql_pconnect acts very much like - mysql_connect with two major differences. + A mysql_pconnect függvény a + mysql_connect függvényhez hasonlóan működik, csupán + két nagyobb különbség van: - First, when connecting, the function would first try to find a - (persistent) link that's already open with the same host, - username and password. If one is found, an identifier for it - will be returned instead of opening a new connection. + Először is, a kapcsolat felvételekor a függvény először megpróbál egy + (perzisztens) kapcsolatot találni, amely már nyitva van arra a hostra + ugyanazzal a név/jelszó párossal. Ha talál ilyet, akkor ennek a kapocsnak + az azonosítóját adja vissza és nem nyit újat. - Second, the connection to the SQL server will not be closed when - the execution of the script ends. Instead, the link will remain - open for future use (mysql_close will not - close links established by mysql_pconnect). + Másodszor pedig a kapcsolat az SQL szerverhez nem kerül bezárásra, amikor + a php program véget ér, hanem megmarad későbbi felhasználásra. + (A mysql_close függvény nem fogja neked lezárni a + mysql_pconnect függvénnyel megnyitott kapcsolatokat). - This type of links is therefore called 'persistent'. + Az ilyen típusú kapcsolatot ezért hívják 'perzisztensnek'. @@ -1745,143 +1653,99 @@ echo "$num_rows Rows\n"; mysql_query - Send a MySQL query + MySQL kérést küld a szervernek - Description + Leírás - resource mysql_query + int mysql_query string query - resource + int link_identifier - mysql_query sends a query to the currently - active database on the server that's associated with the - specified link identifier. If - link_identifier isn't specified, the last - opened link is assumed. If no link is open, the function tries - to establish a link as if mysql_connect was - called with no arguments, and use it. + A mysql_query függvény kérést küld a megadott + kapcsolat-azonosítójú szerver aktív adatbázisához. + Ha nem adsz meg link_identifier-t, akkor a + legutóbb megnyitott kapcsolatot használja a függvény. Ha nincs nyitva + ilyen kapcsolat, akkor a függvény megpróbál nyitni egyet, mintha a + mysql_connect függvényt hívtuk volna paraméterek + nélkül. - The query string should not end with a semicolon. + A kérésnek nem szabad pontosvesszőre végződnie. - mysql_query returns &true; (non-zero) or &false; - to indicate whether or not the query succeeded. A return value - of &true; means that the query was legal and could be executed by - the server. It does not indicate anything about the number of - rows affected or returned. It is perfectly possible for a query - to succeed but affect no rows or return no rows. + A mysql_query függvény TRUE-val (nemnulla) vagy + FALSE-szal tér vissza, attól függően, hogy a kérés teljesítése sikeres + volt-e. A TRUE visszatérési érték azt jelenti, hogy a kérés + szintaktikailag helyes volt, és lefuttatta a szerver. Az érintett sorok + számáról azonban nem mond semmit. Előfordulhat ugyanis, hogy a kérés + sikeresen lefutott, de nem érintett egyetlen sort sem, vagy az + eredményben egyetlen sor sincs. - The following query is syntactically invalid, so - mysql_query fails and returns &false;: + A következő kérés szintaktikailag rossz, igy a + mysql_query függvény meghiúsul és FALSE eredményt + ad: <function>mysql_query</function> <?php -$result = mysql_query ("SELECT * WHERE 1=1") - or die ("Invalid query"); -?> +$eredmeny = mysql_query ("SELECT * WHERE 1=1") + or die ("Érvénytelen lekérdezés"); +?> - The following query is semantically invalid if - my_col is not a column in the table - my_tbl, so mysql_query - fails and returns &false;: + Az alábbi kérés szemantikailag helytelen, ha nincs + my_col nevű oszlop a + my_tbl nevű táblában, így a + mysql_query meghiúsul és FALSE értékkel tér vissza. <function>mysql_query</function> <?php -$result = mysql_query ("SELECT my_col FROM my_tbl") - or die ("Invalid query"); -?> +$eredmeny = mysql_query ("SELECT my_col FROM my_tbl") + or die ("Érvénytelen kérés"); +?> - mysql_query will also fail and return &false; - if you don't have permission to access the table(s) referenced by - the query. + A mysql_query függvény akkor is meghiúsul és FALSE + értékkel tér vissza, ha nincs megfelelő engedélyed a kérés által + hivatkozott táblá(k)hoz. - Assuming the query succeeds, you can call - mysql_num_rows to find out how many rows - were returned for a SELECT statment or - mysql_affected_rows to find out how many - rows were affected by a DELETE, INSERT, REPLACE, or UPDATE - statement. + Feltéve, hogy a kérés sikeres, meghívhatod a + mysql_num_rows függvényt, hogy kiderítsd, hány sort + kaptál vissza a SELECT kérésedre, vagy a + mysql_affected_rows függvényt, hogy megtudd hány + sort érintett a DELETE, NSERT, REPLACE vagy UPDATE kérésed. - For SELECT statements, mysql_query returns a - new result identifier that you can pass to - mysql_result. When you are done with the - result set, you can free the resources associated with it by - calling mysql_free_result. Although, the - memory will automatically be freed at the end of the script's - execution. + SELECT kérés esetében a mysql_query függvény + egy új eredmény-azonosítót ad vissza, amit később a + mysql_result függvénnyel használhatsz. + Ha az eredményre már nincs szükség és memóriafóbiád van, akkor a + mysql_free_result függvénnyel a foglalt memóriát + felszabadíthatod, normál esetben megvárod a program végét és a memória + felszabadul. - See also: mysql_affected_rows, + Lásd még a mysql_affected_rows, mysql_db_query, - mysql_unbuffered_query, mysql_free_result, mysql_result, - mysql_select_db, and - mysql_connect. - - - - - - - mysql_unbuffered_query - Send an SQL query to MySQL, without fetching and buffering the result rows - - - Description - - - resource mysql_unbuffered_query - string query - resource - link_identifier - - int - result_mode - - - - - mysql_unbuffered_query sends a SQL query to MySQL, - without fetching and buffering the result rows automatically, as - mysql_query does. - On the one hand, this saves a considerable amount of memory with SQL - queries that produce large result sets. On the other hand, you can start - working on the result set immediately after the first row has been - retrieved: you don't have to wait until the complete SQL query has been - performed. - - - - The benefits of mysql_unbuffered_query come at a - cost: You cannot use mysql_num_rows on a result set - returned from mysql_unbuffered_query. You also have - to fetch all result rows from an unbuffered SQL query, before you can - send a new SQL query to MySQL. - - - - See also: mysql_query. + mysql_select_db és a + mysql_connect függvényeket! @@ -1889,14 +1753,14 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") mysql_result - Get result data + Eredmény egy sorának lekérdezése - Description + Leírás mixed mysql_result - resource result + int result int row mixed @@ -1906,30 +1770,31 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") - mysql_result returns the contents of one - cell from a MySQL result set. The field argument can be the - field's offset, or the field's name, or the field's table dot - field's name (tabledname.fieldname). If the column name has been - aliased ('select foo as bar from...'), use the alias instead of - the column name. + A mysql_result függvény egy MySQL eredményhalmaz egy + elemét adja vissza. A mező paraméter a mező sorszáma vagy neve lehet vagy + táblanév pont mezőnév (táblanév.mezőnév). Ha az oszlop más néven lett + lekérve, mint ami az oszlop eredeti neve volt + ('select izé as bigyó from...'), akkor használd azt a bizonyos 'más + nevet'! - When working on large result sets, you should consider using one - of the functions that fetch an entire row (specified below). As - these functions return the contents of multiple cells in one - function call, they're MUCH quicker than - mysql_result. Also, note that specifying a - numeric offset for the field argument is much quicker than - specifying a fieldname or tablename.fieldname argument. + Amikor nagy eredményhalmazokkal dolgozol, akkor mérlegelned kell az olyan + függvyének használatát, amelyek az egész eredménysort betöltik. Mivel + ezek több cella tartalmát olvassák be egy függvényhívással, így ezek + SOKKAL gyorsabbak, mint a + mysql_result függvény hívogatása. Említést érdemel + még, hogy a numerikus index használata jóval gyorsabb, mint a mezőnév + vagy a táblanév.mezőnév forma használata. - Calls to mysql_result should not be mixed - with calls to other functions that deal with the result set. + A mysql_result függvényhívásokat más, ugyanazon + eredményhalmazzal foglalkozó függvényhívásokkal nem illik (gyk. TILOS) + együtt használni! - Recommended high-performance alternatives: + Ajánlott az alábbi, gyors [és programozóbarát] függvények használata: mysql_fetch_row, - mysql_fetch_array, and + mysql_fetch_array és mysql_fetch_object. @@ -1938,15 +1803,15 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") mysql_select_db - Select a MySQL database + Kiválaszt egy MySQL adatbázist - Description + Leírás - bool mysql_select_db + int mysql_select_db string database_name - resource + int link_identifier @@ -1954,28 +1819,28 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") - Returns: &true; on success, &false; on error. + Visszatérési érték: true, ha sikeres; false ha hiba történt. - mysql_select_db sets the current active - database on the server that's associated with the specified link - identifier. If no link identifier is specified, the last opened - link is assumed. If no link is open, the function will try to - establish a link as if mysql_connect was - called, and use it. + A mysql_select_db függvény az adott + kapcsolat-azonosítójú szerverkapcsolat adatbázisát módosítja. Ha nincs + kapcsolat-azonosító megadva, akkor az utoljára megnyitott kapcsolatban + választ adatbázist. Ha ilyen sincs, akkor megpróbál a MySQL szerverhez + kapcsolódni úgy, mintha a mysql_connect függvény + lett volna meghívva paraméterek nélkül. - Every subsequent call to mysql_query will be - made on the active database. + Az összes további mysql_query függvény az aktív + adatbázison fog történni. - See also: + Lásd még a mysql_connect, - mysql_pconnect, and - mysql_query. + mysql_pconnect és a + mysql_query függvényeket! - For downward compatibility mysql_selectdb - can also be used. + Kompatíbilitási okokból a mysql_selectdb + függvény is használható. @@ -1983,140 +1848,43 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") mysql_tablename - Get table name of field + Egy tábla nevével tér vissza - Description + Leírás string mysql_tablename - resource result + int result int i - mysql_tablename takes a result pointer - returned by the mysql_list_tables function - as well as an integer index and returns the name of a table. The - mysql_num_rows function may be used to - determine the number of tables in the result pointer. + A mysql_tablename függvény veszi a + mysql_list_tables függvény által visszaadott + eredmény-mutatót és egy indexet, majd megmondja az oszlophoz tartozó + tábla nevét. A + mysql_num_rows függvény használható arra, hogy + megmondja hány tábla van az eredményhalmazban. - <function>mysql_tablename</function> Example + <function>Mysql_tablename</function> példa <?php mysql_connect ("localhost:3306"); -$result = mysql_list_tables ("wisconsin"); +$eredmeny = mysql_list_tables ("wisconsin"); $i = 0; -while ($i < mysql_num_rows ($result)) { - $tb_names[$i] = mysql_tablename ($result, $i); +while ($i < mysql_num_rows ($eredmeny)) { + $tb_names[$i] = mysql_tablename ($eredmeny, $i); echo $tb_names[$i] . "<BR>"; $i++; } -?> +?> - - - mysql_get_client_info - Get MySQL client info - - - Description - - - string mysql_get_client_info - - - - - mysql_get_client_info returns a string that represents - the client library version. - - - mysql_get_client_info was added in PHP 4.0.5. - - - - - - - mysql_get_host_info - Get MySQL host info - - - Description - - - string mysql_get_host_info - resource link_identifier - - - - mysql_get_host_info returns a string - describing the type of connection in use for the connection - link_identifier, including the server host name. - If link_identifier is omited, the last opened - connection will be used. - - - mysql_get_host_info was added in PHP 4.0.5. - - - - - - - mysql_get_proto_info - Get MySQL protocol info - - - Description - - - int mysql_get_proto_info - resource link_identifier - - - - mysql_get_proto_info returns the protocol version - used by connection link_identifier. - If link_identifier is omited, the last opened - connection will be used. - - - mysql_get_proto_info was added in PHP 4.0.5. - - - - - - - mysql_get_server_info - Get MySQL server info - - - Description - - - int mysql_get_server_info - resource link_identifier - - - - mysql_get_server_info returns the server version - used by connection link_identifier. - If link_identifier is omited, the last opened - connection will be used. - - - mysql_get_server_info was added in PHP 4.0.5. - - -