I want to display/add/delete data from several table in MVC component, in JTable
class:
class HelloWorldTableHelloWorld extends JTable
{
function __construct(&$db)
{
parent::__construct('code', 'id', $db);
//parent::__construct('#__fairinfo', 'flight_id', $db);
//parent::__construct('hotelinfo', 'hotelid', $db);
}
}
Constructor initializes the id's of tables for deletion and edition purpose. I have successfully displayed the data of three tables, but when I performed the deletion operation then only that table data is delete, which is initailized in JTable
class, but if I add all tables and initialize them in JTable
it gives me an error.
Joomla is not designed to work that way. You are meant to use one table file per database table.
In your model you can instantiate all three tables if needed, but each table file should be separate.
In your model do the following:
Then you can:
or
etc;
But instead of messing about with all of this, why don't you give the component creator a try?