| « Joomla - Component: Available Toolbar Buttons | Joomla - Component: Creating Form Input Data at Back End » |
Now, we create a table for preparing place where data will go. For first time, make sure what prefix database you use. You can check on menu Site > Global Configuration > Server. Assuming, that your database prefix is jos_.
If you prefer SQL statement, you can write following code:
CREATE TABLE `jos_hello` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `message` TEXT NOT NULL , `published` TINYINT( 1 ) NOT NULL );
If you prefer use web-based database manager such phpMyAdmin, folow this steps:
Don't forget define primary key and auto_increment for id.

Click Save button.
Creating a Table Class
We could write individual functions to take care of the queries necessary to add, update, and delete data. Fortunately, the Joomla! team has ready done this for you. The JTable class provides functions for performing modify data from single table in the database. We just extend the class.
Following steps to create table class:
<?php
defined('_JEXEC') or die('Restricted Access');
class TableHello extends JTable
{
var $id = null;
var $message = null;
var $published = 0;
/**
* @param database A database
connector object */
function __construct(&$db)
{
parent::__construct( '#__hello', 'id', $db );
}
}
?>