ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:activerecord:getattributenames

This is an old revision of the document!


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.1449329755.txt.gz · Last modified: 2017/04/21 11:21 (external edit)