1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P80 docx

5 189 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 363,73 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

dbase_add_record Syntax bool dbase_add_record int dbase_identifier, array record Description The dbase_add_record function, which is available in PHP 3.0.16 and prior along with PHP

Trang 1

bool dbase_pack (int dbase_identifier)

Description

The dbase_pack() function, which is available in PHP 3.0.16 and prior along with PHP 4.0, packs the dBASE file represented by the dbase_identifier parameter

When a record is deleted in dBASE using SQL, the record is only marked for deletion and not actually removed This function causes the record to be removed from the database

dbase_add_record()

Syntax

bool dbase_add_record (int dbase_identifier, array record)

Description

The dbase_add_record() function, which is available in PHP 3.0.16 and prior along with PHP 4.0, adds a record to the dBASE database specified by the

dbase_identifier parameter The record parameter must match the record type of

the dBASE database or the call will be unsuccessful and FALSE will be returned

dbase_replace_record()

Syntax

bool dbase_replace_record (int dbase_identifier, array record,

int dbase_record, int dbase_record_number)

Description

The dbase_replace_record() function, which is available in PHP 3.0.16 and prior along with PHP 4.0, replaces the record at the location specified by the

dbase_record_ number parameter in the database referenced by the

dbase_identifier parameter The dbase_record type must match the record it is

replacing; otherwise, the replacement is unsuccessful and FALSE is returned

dbase_delete_record()

Trang 2

Syntax

bool dbase_delete_record (int dbase_identifier, int record)

Description

The dbase_delete_record() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, marks a record to be deleted from the database referenced by the dbase_identifier parameter The record is not actually removed

from the database until dbase_pack() is called

dbase_get_record()

Syntax

array dbase_get_record (int dbase_identifier, int record)

Description

The dbase_get_record() function, which is available in PHP 3.0.16 and prior along with PHP 4.0, returns the record indicated by the record parameter in the database

referenced by the dbase_identifier parameter The record is returned as an array

with a starting index of 0 as well as an associative member named 'deleted', which represents whether the record has been marked for deletion with '1' meaning TRUE Each field is converted into the appropriate PHP data type with dates left as strings

dbase_get_record_with_names()

Syntax

array dbase_get_record_with_names (int dbase_identifier, int record)

Description

The dbase_get_record_with_names() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, returns the record indicated by the record parameter in the database referenced by the dbase_identifier parameter The

record is returned as an associative array with a member named 'deleted' which represents whether the record has been marked for deletion with '1' meaning TRUE Each field is converted into the appropriate PHP data type with dates left as strings

Trang 3

Syntax

int dbase_numfields (int dbase_identifier)

Description

The dbase_numfields() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, returns the number of fields in a dBASE database referenced by the dbase_identifier parameter Note that field numbers are zero-based and

record numbers are one-based

dbase_numrecords()

Syntax

int dbase_numrecords (int dbase_identifier)

Description

The dbase_numrecords() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, returns the number of rows in a dBASE database referenced by the dbase_identifier parameter Note that record numbers are

one-based and field numbers are zero-one-based

DBM

The DBM functions enable you to access data stored in one of the many DBM-style databases such as Berkeley DB, Gdbm, system libraries, and some of the flat-file databases that exist DBM databases store key and value pairs as opposed to relational databases, which store variable-length records of related data The following example opens a DBM database and retrieves the password of user123:

<?

$dbm_db = dbmopen("users","r");

echo dbm_fetch($dbm_db,"user123");

$dbmclose (dbm_db);

?>

dbmopen()

Trang 4

Syntax

int dbmopen (string filename, string flags)

Description

The dbmopen() function, which is available in PHP 3.0.16 and prior along with PHP 4.0, is used to open a connection to a DBM file The path parameter represents the

full path to the DBM file The mode parameter can be one of four options: 'r' for read access, 'w' for read/write access to an existing database, 'c' for read/write and create, or 'n' for create, read/write, and truncate The returned value can be used as a handle to subsequent DBM function calls Note that PHP does its own file locking (by creating lck files) in addition to any file locking done by the database

dbmclose()

Syntax

bool dbmclose (int dbm_identifier)

Description

The dbmclose() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, closes the DBM file referenced by the dbm_identifier parameter and

closes any associated locks The function returns TRUE on success, and FALSE otherwise

dbmexists()

Syntax

bool dbmexists (int dbm_identifier, string key)

Description

The dbmexists() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, returns TRUE if a value associated with the key parameter exists in the

DBM file referenced by the dbm_identifier parameter

dbmfetch()

Trang 5

string dbmfetch (int dbm_identifier, string key)

Description

The dbmfetch() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, returns the value associated with the key parameter from the DBM file

referenced by the dbm_identifier parameter

dbminsert()

Syntax

int dbminsert (int dbm_identifier, string key, string value)

Description

The dbminsert() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, inserts the record into the DBM file indicated by the dbm_identifier parameter The record is comprised of the key and value parameters The possible

return values are 0 for success, 1 for key already exists, and –1 for file opened in read-only mode You should use dbmreplace() if you want to change an existing value

dbmreplace()

Syntax

bool dbmreplace (int dbm_identifier, string key, string value)

Description

The dbmreplace() function, which is available in PHP 3.0.16 and prior versions along with PHP 4.0, replaces the value previously associated with the key parameter with

the value parameter in the database referenced by the dbm_identifier parameter

A return value of TRUE indicates success and FALSE indicates otherwise

dbmdelete()

Ngày đăng: 07/07/2014, 05:20