How-To's

How To Create New Database Table On ClipBucket Plugin Installation

If you are creating a plugin and you would like to create a new table in MySQL database upon installation, follow the steps below.

Step 1:

Create a new PHP file in plugin folder and name it install_plugin_name.php

Step 2:

Paste following code into that file.

<?php

require_once('../includes/common.php');

function install_plugin_name()
{
	global $db;
	$db->Execute(
	'CREATE TABLE IF NOT EXISTS '.tbl("your_table_name ").' (
	  `your_column_name` text NOT NULL
	) ENGINE=MyISAM DEFAULT CHARSET=utf8;;'
	);
	$db->Execute("INSERT INTO  ".tbl(‘your_table_name’)." (your_column_name) VALUES ('')");
}
function install_plugin_name();
?>

Save it.

Step 3:

Now install your plugin and go to phpMyAdmin. Click on your ClipBucket database name and there you will see your newly created table among other ClipBucket tables.

How To Drop Plugin Table On Uninstallation