Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

bramwittendorp on "MySQL database installation is not working"

$
0
0

For my first WordPress plugin I chose to make it my self difficult because I want to use a new table in the WordPress database installation.

However if I install the plugin the database tables are not created for some sort of reason. I checked the query in phpMyAdmin and it runs fine in there so there aren't any errors in the query, but what am I doing wrong?

<?php
// database creation
function create_rozenactie(){

$sql1 = "CREATE TABLE rozenactie (
  order_id int(11) NOT NULL AUTO_INCREMENT,
  ontvanger varchar(225) NOT NULL,
  klas_ontvanger varchar(50) NOT NULL,
  boodschap varchar(250) NOT NULL,
  aantal int(11) NOT NULL,
  bedrag int(11) NOT NULL,
  afzender varchar(225) NOT NULL,
  klas_afzender varchar(225) NOT NULL,
  email varchar(250) NOT NULL,
  betaalmoment varchar(250) NOT NULL,
  betaald varchar(200) NOT NULL,
  anoniem varchar(20) NOT NULL,
  PRIMARY KEY  (order_id)
);";

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta($sql1) or die("Instalatie tabel Rozenactie mislukt");

}

function create_algemeen(){

$sql2 = "CREATE TABLE algemeen(
  actief varchar(25) NOT NULL,
  prijs varchar(11) NOT NULL
);";

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta($sql2) or die("Instalatie tabel Algemeen mislukt");
}

function insert_general_settings(){
global $wpdb;

$aanpassen = $wpdb->insert( algemeen, array('actief' => 'true', 'prijs' => '1') );
$aanpassen;
}
?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles