Firefox 3
Quick navigation:

ptb_addField

Adds $newFieldname as a new field to the $filename. If the $newFieldname already exists, it is, of course, not added.–You probably want to use this function only in some sort of database managment script.

Syntax

ptb_addField($filename, $location, $newFieldname[, $defaultValue = '']);

Syntax description

$filename
name of file containing the database
$location
location of $filename; can be:
G
globally defined (in ptb_ini.php) directory
L
local directory (ie. the same where script calling ptb_connect is placed)
<path>
other, defined directory, eg. /samples/db (no trailing slash)
F
filename (ie. absolute or relative path without DOCUMENT_ROOT dependency)
$newFieldname
name of the new field
$defaultValue
optional: value for the new field (default is null)

Return

This function returns true on success and null (=false) on failure.

Sample(s)

Add new field french to the christie.csv file and set its value to 1 for all the records:

ptb_addField('christie.csv', 'G', 'french', '1');

See also:

ptb_delFieldptb_changeFieldname