User Menu
Keywords
|
Plugins > MySQL TablesThis section describes three aspects of WikyBlog Plugins and MySQL Tables.
Referencing TablesThe most important aspect of referencing tables in your plugin is the usage of the $wbTablePrefix variable. <?php global $wbTablePrefix; $table = "`{$wbTablePrefix}custom_table`"; Creating and Modifying TablesDuring the development process of your plugin, I highly recommend using phpMyAdmin to create and modify your tables beyond what can be accomplished with the Custom Data Types tool. Including Tables With Your PluginOnce your tables have been created, you can use the Plugin SQL tool in the Administrator's Control Panel to export the appropriate code for the sql.php file of your plugin. The sql.php file should be created in your plugin's root directory. Example sql.php File<?php defined('WikyBlog') or die('Not an entry point...'); $dbData = 'a:1:{s:11:"url_example";a:5:{s:6:"Engine";s:6:"MyISAM";s:9:"Collation";s:15:"utf8_general_ci";s:15:"Default_charset";s:4:"utf8";s:7:"columns";a:2:{s:2:"id";s:36:"`id` int(11) NOT NULL auto_increment";s:3:"url";s:28:"`url` varchar(255) NOT NULL ";}s:4:"keys";a:1:{s:7:"PRIMARY";s:18:"PRIMARY KEY (`id`)";}}}'; This serialized code contains the following information for the url_example table.
|