ptb_changeFieldname
Changes $oldFieldname to $newFieldname. $filename is checked for both names: if it already contains the new name or doesn't contain old one, nothing happens.–You probably want to use this function only in some sort of database managment script.
Prior to version 1.2 this function's name was ptb_changeFieldName.
Syntax
ptb_changeFieldname($filename, $location, $oldFieldname, $newFieldname);
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)
- $oldFieldname
- field which name is to be changed
- $newFieldname
- new field name
Return
This function returns true on success and null (=false) on failure.
Sample(s)
Change field aka to other_titles in the christie.csv file:
ptb_changeFieldname('christie.csv', 'G', 'aka', 'other_titles');