Table is an abstract class which models the database and need to put constructor which declares the table name and primary key and also override some methods. It is used for creating,updating, reading and deleting of records in database. As this class is abstract so few methods will be overridden by the child class. Some of the methods which JTable provides for manipulating the records in database are Load,save etc.
For using JTable class we need to create class which inherit parent class JTable define constructor inside which will call the parent constructor to get the table. Inside constructor need to provide name of table, primarykey field column and database instance.
class TableMytable extends JTable
{
public function __construct($db)
{
parent::__construct( '#__mytable', 'id', $db );
}
}
0 Comment(s)