Questions tagged [dbdelta]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
30 views

cant insert data in a custom table in phpmyadmin

i created a dbdelta table but i cant seem to insert any data here is my code please help function lapizzeria_save_reservation() { global $wpdb; if(isset($_POST['reservation']) && $_POST['...
0
votes
1answer
22 views

dbDelta not CREATING TABLE

Here's my code. Please help function lapizzeria_database() { global $wpdb; global $lapizzeria_db_version; $lapizzeria_db_version = "1.0"; $table = $wpdb->prefix . 'reservation'; ...
0
votes
0answers
12 views

dbDelta change PRIMARY KEY

I have a table with a composite primary key (call_id, submission_id). Now, I would like to change the composite primary key (call_id, submission_id, version). The code I am running is similar to the ...
1
vote
1answer
26 views

dbDelta with the character ;

To manage database plugin update, I changed my code using dbDelta. old code myfunction(){ ... $query_string = "INSERT INTO {$table_name} {$str_column_names} VALUES {$str_values}"; $...
0
votes
1answer
116 views

Create table with dbDelta,can't put any DEFAULT data

I want to add more custom tables to wp_users. but I want them to contain a default JSON data. This one works...when the DEFAULT is empty... register_activation_hook(__FILE__, 'toto_user_db_setup')...
0
votes
1answer
70 views

Creating a database in my plugin not working

Good day everyone, I've been trying to add a table in my database for a whole day now, and I can't seem to find the error, I looked into multiple similar questions, but I had my syntax similar to all ...
0
votes
1answer
159 views

Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working

So interestingly, I moved my main plugin file into a folder within the plugin directory. Where before the register_activation_hook worked perfectly well, it now does not work; however, the ...
1
vote
0answers
62 views

The function can not create a table on MariaDB server

The function works on MySQL server well but it can not create a table on the MariaDB server. What could be the problem? public function create_table() { $current_version = get_option('...
1
vote
0answers
154 views

dbDelta not creating table (yes, once more)

I KNOW there are other posts relating to my issue, i read all of them and tried to see if the answer would change and tried a few ones, but I can't seem to create my table using it. Here's my code (...
2
votes
2answers
2k views

Custom database table for plugin not creating on activation

Let me start by saying I know there are other posts about this, and a lot of documentation is available for this topic, but none of these resources have helped me to solve my issue. I'm a beginner at ...
0
votes
1answer
618 views

dbDelta not adding additional columns in plugin database update

I'm trying to update my database by adding an extra column field. However, dBdelta does not seem to be doing its job. I'm not sure what am I doing wrong. <?php function installer(){ include('...
1
vote
2answers
1k views

Unable to create new database table upon plugin activation using dbDelta

I'm trying to create a new database table when my plugin is activated using dbDelta() however, no new table seems to be creating. Since I'm new to WordPress development, please let me know where I'm ...
2
votes
1answer
3k views

Fatal error: Call to undefined function dbDelta()

I want to create a table during the activation of the plugin, so I used the code as follows: class Database { private $db_version = '1.0', $table_prefix; public function __construct() { ...
4
votes
1answer
515 views

dbDelta does not create Table, but returns success

I wrote a Plugin, which creates a table on activation. On previous WP Versions, it worked fine. Now it doesn't. This is my function: function on_activation(){ global $wpdb; $...
0
votes
1answer
404 views

dbDelta() Error - Incorrect index name '' for query ALTER TABLE

The famous dbDelta() function in WordPress is causing me problems in multiple plugins. No change I make to my create table query seems to fix the problem or it does fix it and dbDelta() causes a ...
1
vote
2answers
1k views

How to update an existing table while updating plugin?

I have added a new field (time_last_seen) in my plugin (v1.1) table then uploaded my plugin as version 1.2 to wordpress svn repository. When I update my plugin from admin panel, it is not creating ...
0
votes
1answer
821 views

DBDelta: “table doesn't exist” for a table that was just created

When I run the following code: global $wpdb; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); $table_tags = $wpdb->prefix . "tags_tb"; $sql = "CREATE TABLE $table_tags ( ...
4
votes
1answer
856 views

How to define composite keys with dbDelta()

I am getting error while trying to create a table with dbDelta() and composite primary key. The sql is pretty straight forward. $sql = "CREATE TABLE {$wpdb->prefix}voicemail_call ( user_id ...
1
vote
1answer
74 views

Unable to set a default serialized array using dbdelta()

I am trying to set up a table with dbDelta() and one of the columns will have as default a serialized array with predefined values. The issue here is that dbDelta() explodes the query using ...
0
votes
1answer
292 views

dbDelta not installing database

I'm not sure why this isn't running. When I output dbDelta it says that it created the table, but it doesn't. I think my SQL is valid. Taking everything out between id and UNIQUE KEY results in the ...
0
votes
1answer
1k views

dbDelta not creating tables with composite keys

I've been trying to figure this one out for 3 days now, reading every reference on dbDelta I can find. My ultimate goal is to create a table of unique ad_id, ad_trigger pairs. This does not create a ...
0
votes
1answer
39 views

Creates only one table and not the other

I have this function to create two tables when I activate the plugin. Only the wp_wpt_stats table are being created and not the wp_wpt_list. I know the dbdelta is picky, but I can't see what I'm doing ...
0
votes
1answer
56 views

Wordpress dbdelta a semicolon

I have a query, something like this $drzava ="CREATE TABLE IF NOT EXISTS`wp_drzava` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Kod` varchar(2) NOT NULL, `Naziv` varchar(100) NOT NULL, ...
3
votes
2answers
1k views

Why does dbDelta() not catch MysqlErrors?

From what I can see, dbDelta() is designed to suppress database errors that occur during its operation. Generally speaking, this seems to be the case, but New Relic is still reporting MysqlErrors ...
-1
votes
1answer
151 views

What is wrong with this dbDelta syntax?

I know there's a million questions about this, but I've searched a bunch and haven't found any solutions that fix my problem. This is the function which I hook upon plugin activation: global $wpdb; $...
0
votes
1answer
118 views

Create new database through static page code

I want to create a new table in current database of word press through create a static page. I write code for this as below, but there was no result. Why is that, and how can I get this right? <?...
0
votes
1answer
242 views

Is altering a default WordPress database table update safe?

I want to add some table columns to the wp_terms table. Is it safe to use the dbDelta function with a modified CREATE-MySQL query for this? Or will I run into problems in the long turn? Is it update ...
1
vote
1answer
833 views

dbDelta using Foreign key not working on update [duplicate]

I am using FOREIGN KEY with dbDelta when activating the plugin (register_activation_hook()). It works great when creating the table for the first time, but outputs an error when updating the table (...
0
votes
1answer
71 views

dbDelta not doing what it says

Okay so I must have read hundreds of wordpress answers, google results etc on different people having trouble with dbDelta creating tables for their plugins. Ive tried many variations based off of ...
0
votes
1answer
132 views

Print output of Table Creation

I am creating a few tables and I getting the following message: The plugin generated 440 characters of unexpected output during activation. If you notice “headers already sent” messages, problems ...
2
votes
2answers
110 views

What files to keep after upgrading WordPress?

We were recently handed a few blogs/sites to support, that have started way back when wordpress was on v2.1.3 or even 2.0.4 After upgrading the sites to the latest versions (3.4.2 and 3.5) we found ...
2
votes
1answer
9k views

dbDelta ALTER TABLE syntax?

Due to some changes in the DB, I need to alter a table to add one column to it, but even though the function is running, the table isn't altered. Here's the ALTER TABLE code that I've written $sql = "...
15
votes
5answers
11k views

dbDelta not creating tables

I went through a lot of threads, codex page and tried messing with a lot of things but my code doesn't seem to be creating the tables. And I am not able to figure out where I am going wrong. I checked ...
7
votes
2answers
3k views

Does dbDelta delete columns as well?

I created a table using the dbDelta function and then removed a few columns and added a few. The new columns did get created but the old columns did not get deleted from the table. Is there a ...
2
votes
1answer
1k views

Problem in creating table through plugin code

I'm using the following code to create the database table using plugin. However, the table is neither getting created nor I'm getting any error message. The code is as follows: global $wpdb; ...
9
votes
1answer
3k views

dbDelta support for FOREIGN KEY

On PHP 5.3.13/MySQL 5.5.21 the following code doesn't work: if($check_custom_fields_form!=1){ $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." ( `form_name` ...
5
votes
2answers
3k views

dbDelta only creates the last table

I'm using following install function with dbDelta as referring to the codex, articles on SO I watched out for the typical problems with e.g. one space instead of two spaced at the PRIMARY KEY ... ...
0
votes
1answer
1k views

dbdelta failing with error: "WordPress database error Table 'wp_2_myPlugin' already exists

I'm upgrading a plugin and having issues with dbdelta. Here's the original db creation function: global $jal_db_version; $jal_db_version = "0.1"; function jal_install() { global $jal_db_version;...
4
votes
1answer
2k views

Problems with DBDelta with FOREIGN key?

I have the following sql I am using with dbDelta: $sql .= "CREATE TABLE " . $location_table . " ( location_id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, name VARCHAR (100), ...