igmoweb
10/8/2014 - 2:42 PM

fictizia-create-table.php

<?php
global $wpdb;

$tablename = $wpdb->prefix . 'fictizia_clientes';

$charset_collate = '';
if ( ! empty($wpdb->charset) )
	$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
	$charset_collate .= " COLLATE $wpdb->collate";

$sql = "CREATE TABLE IF NOT EXISTS $tablename (
	`ID` bigint(20) NOT NULL auto_increment,
	`nombre_cliente` varchar(200) DEFAULT '',
	PRIMARY KEY  (ID),
	KEY nombre_cliente (nombre_cliente)
) $charset_collate";

require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);