Answers for "create table in wordpress plugin"

PHP
1

create table in wordpress plugin

<?php
function table_create()
{
global $wpdb;
$table_name = $wpdb->prefix . "wpactable"; 
$charset_collate = $wpdb->get_charset_collate();
 $sql = "CREATE TABLE IF NOT EXISTS $table_name (
  id mediumint(9) NOT NULL AUTO_INCREMENT,
  name tinytext NOT NULL,
  email tinytext NOT NULL,
  number tinytext NOT NULL,
  Website text NOT NULL,
  PRIMARY KEY  (id)
) $charset_collate";
require_once( ABSPATH .'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
}

?>
Posted by: Guest on January-25-2021

Code answers related to "create table in wordpress plugin"

Browse Popular Code Answers by Language