PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




dbase_add_record

Name

dbase_add_record — Adds a record to a dbf file.

Synopsis

bool dbase_add_record(identifier, record);
int identifier: dbf identifier
array record: Array for use as a dbf record

Returns

TRUE on success; FALSE on error.

Description

dbase_add_record() adds a new record to the specified dbf file. The values for the new record are taken from the record argument.

The record argument should be a single-dimension array that has as many elements as the dbf file has rows. If any of the array elements contain values that are outside the bounds set by the row definition, the data will be silently truncated to the defined length for the row.

The function will return FALSE in a wide variety of circumstances:

- If the record argument is not an array

- If the array doesn't contain the right number of elements

- If the dbf_identifier argument doesn't refer to an open dbf file

- If a memory allocation error occurs

Version

PHP Version: 3+, 4+

See also

To replace an existing record in a dbf file

dbase_replace_record()

To mark a record for deletion from a dbf file

dbase_delete_record()

To remove records marked for deletion

dbase_pack()

Example

Example 222. Open a dbf file and write a record to it

$db_file = '/tmp/run_log.dbf';

# open dbf file for writing
$id = @ dbase_open ($db_file, 1)
    or die ("Could not open dbf file <i>$db_file</i>."); 

# Quick and dirty insert of data
dbase_add_record ($id, array ($SCRIPT_NAME, $UID, time ())
    or die ("Could not add a record to dbf file <i>$db_file</i>.");



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.