ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:activerecord:getattributenames

getAttributeNames

Syntax
  mixed[] getAttributeNames()

Description

This method returns the names of the columns in the table associated with an Active Record object.

Usage

$db->execute("CREATE TEMPORARY TABLE `persons` (
                `id` int(10) unsigned NOT NULL auto_increment,
                `name_first` varchar(100) NOT NULL default '',
                `name_last` varchar(100) NOT NULL default '',
                `favorite_color` varchar(100) NOT NULL default '',
                PRIMARY KEY  (`id`)
            ) ENGINE=MyISAM;
           ");
 
class person extends ADOdb_Active_Record{}
$person = new person();
 
var_dump($person->getAttributeNames());
 
/**
 * Outputs the following:
 * array(4) {
 *    [0]=> string(2) "id"
 *    [1]=> string(9) "name_first"
 *    [2]=> string(8) "name_last"
 *    [3]=> string(13) "favorite_color"
 *  }
 */
v5/activerecord/getattributenames.txt · Last modified: 2018/07/02 14:19 by peterdd