The following functions work on dBase files, which typically end with a .dbf extension. If you are using the precompiled version for Windows, you will need to load the dBase extension by editing php.ini or using the dl function. The extension is likely called php_dbase.dll but was unavailable at the time of this writing. On other operating systems it's easy to compile dBase support into PHP. The dBase functionality in PHP is somewhat limited. Index and memo fields are not supported. Neither is any kind of locking. The dBase functionality in PHP is meant to be a means of importing data from what has become somewhat of a lowest common denominator in data exchange. Jim Winstead added dBase support to PHP.
boolean dbase_add_record(integer database, array record)
The dbase_add_record function adds a record to the database specified by a database identifier returned by dbase_open. The record array contains an element for each field in the database, in order and starting at zero. If the correct number of fields is not supplied, FALSE is returned.
boolean dbase_close(integer database)
The dbase_close function closes a database. See other functions in this section for examples of use.
integer dbase_create(string filename, array fields)
The dbase_create function creates a dBase database. The fields argument is an array of arrays that describe fields. Each array may have up to four elements. In order, they are name, type, length, and precision. Type is a single character. Some types require length, and precision; others do not.
If a database is successfully created, a database identifier is returned; otherwise FALSE is returned.
boolean dbase_delete_record(integer database, integer record)
The dbase_delete_record function marks a record for deletion. The record will remain in the database until dbase_pack is called.
array dbase_get_record(integer database, integer record)
The dbase_get_record function returns the fields of a record in an array. The first field will be numbered zero. In addition, an element indexed by deleted will contain 1 if the row was marked for deletion. Records are numbered from one.
array dbase_get_record_with_names(integer database, integer record)
This function behaves like dbase_get_record, except that instead of being indexed by integers, fields are indexed by their names.
integer dbase_numfields(integer database)
The dbase_numfields function returns the number of fields for the given database. See the description of dbase_get_record for an example of its use.
integer dbase_numrecords(integer database)
The dbase_numrecords function returns the number of records in the database. See the description of dbase_get_record for an example of its use.
integer dbase_open(string filename, integer mode)
Use dbase_open to get a dbase identifier. This integer is needed for identifying which database to operate on. The mode may be 0 for read-only, 1 for write-only, or 2 for allowing both reading and writing. FALSE is returned if the database cannot be opened. The other examples in this section demonstrate dbase_open.
boolean dbase_pack(integer database)
When rows are deleted in a dbase database, they are simply marked for deletion. Use the base_pack function to permanently remove these rows, thus packing the database.
boolean dbase_replace_record(integer database, array record, integer record_number)
Use dbase_replace_record to change the contents of a record. The record argument must have one element for each field defined in the database. Record numbers start counting at one.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
An Introduction To Php
Variables, Operators, And Expressions
Classes And Objects
I/o And Disk Access
Time, Date, And Configuration Functions
Parsing And String Evaluation
Sorting Searching And Random Numbers
Integration With Html
Efficiency And Debugging
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.