ptb_fieldnames
List names of all fields in the $database or tells if a $fieldname exists in it.
Syntax
$var = ptb_fieldnames($database[, $fieldname = '']);
Syntax description
- $database
- variable containing connected database
- $fieldname
- optional: name of a field, which existence in $database you want to check
Return
This function used with one argument returns array or null if database is empty; used with two arguments returns true if the $fieldname exists or null (=false) otherwise.
Sample(s)
if (ptb_fieldnames($myDatabase, 'author')) {
// if field 'author' exists in $myDatabase, proceed
...