Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 16 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow 11. API Reference arrow [REVIEW] database->getTableCreate

[REVIEW] database->getTableCreate PDF Print E-mail

Last reviewed: Not reviewed
phpDocumentor

database->getTableCreate

Generates the SQL code that would be required to create new (empty) tables exactly like the ones specified.  Returns an array of SQL 'CREATE TABLE' statements.

Syntax

array getTableCreate ( array $tables )

$tablesis an array of table names for which SQL statements are to be generated.

Examples

Example:

function generateSQL() {
  global $database;
 
  $prefix = $database->_table_prefix;
  $tables = array( $prefix.'content_frontpage', $prefix.'content_rating' );
  $result = $database->getTableCreate( $tables );
  print_r( $result );
}
 
generateSQL();

might produce:

Array
(
    [jos_content_frontpage] => Array
        (
            [0] => CREATE TABLE `jos_content_frontpage` (
  `content_id` int(11) NOT NULL default '0',
  `ordering` int(11) NOT NULL default '0',
  PRIMARY KEY  (`content_id`)
) TYPE=MyISAM
        )
 
    [jos_content_rating] => Array
        (
            [0] => CREATE TABLE `jos_content_rating` (
  `content_id` int(11) NOT NULL default '0',
  `rating_sum` int(11) unsigned NOT NULL default '0',
  `rating_count` int(11) unsigned NOT NULL default '0',
  `lastip` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`content_id`)
) TYPE=MyISAM
        )
 
)

Please report any errors on this page to the Developer Documentation Forum

Last Updated ( Monday, 25 December 2006 )
 
< Prev   Next >