Active DB queries in WordPress?

wpdb doesn’t include such kind of API, mostly since it descended from ezSQL which didn’t either (as far as I remember). While there are some helpers for insert/update stuff, most of query abstraction happens in WP_Query since that’s where bulk of complicated querying is typically going on.

Using WPDB->Insert()

Short answer, no. WPDB is a class that’s been around for a while (back when WP used to support PHP 4), and lacks a lot of features PHP5 drivers offer, including parameter binding. As you mentioned, wpdb::insert is the closest you can get to your original code: $wpdb->insert( ‘importtest’, array( ‘id’ => $ID, ‘area’ => … Read more

Is there a page length limit?

The post content field is MySQL type longtext, which has a limit of 4 gigabytes. What you may be encountering is an issue with the TinyMCE editor. Content is processed and validated in the browser with JavaScript. If that’s the case, I doubt you will improve your situation by using Drupal, since you will be … Read more

Can’t run database query

Here issue with the column name. You are using column key in the query which is the default keyword/index in mysql. For resolving this kind of issue just use the “Grave accent(`)’ symbol in the query for the column name, No need to change the column name. So in your case the right query is … Read more

WordPress create database not working

dbDelta() is very picky, below I’ve checked the requirements for dbDelta() in your code. As you can see below your code fails two of the requirements which most likely prevents dbDelta() from creating the tables. You must put each field on its own line in your SQL statement. CHECK You must have two spaces between … Read more

Database Structure on Different Servers

I don’t think WordPress can manage two databases at the same time (unless you tweak it significantly, by means of HyperDB1). So, you’d probably will like the job of abstracting two databases and making them look like one to WordPress to be done by the database functionality. WordPress can work mostly with MySQL (see WordPress … Read more

SQL syntax error when getting data for a url

Are you sure you didn’t mean $wpdb->staff? By ommitting the $, the query now looks for a table called wpdb->staff, which isn’t valid SQL As an aside, had you considered using a custom post type/user meta instead of a custom table? Or even a custom taxonomy on users? Note as well that if you never … Read more

Update MySQL query so that it functions again

mysql_fetch_object() was deprecated in PHP 5.5 and fully removed in PHP 7.0, which is probably why it no longer works for you. It’s always better to use WP functions – often they are wrappers for something in PHP (or elsewhere), but by using the WP wrapper version, it usually protects you from deprecation (since the … Read more

Is it possible to create a WordPress table using array and loop?

This is a code review question more than a WordPress question. Please post these in the Code Review Stack Exchange in the future. You have a couple things wrong or not according to best practices. Comments inline for where I made changes. $cr_table_array = array( array( ‘data_field’ => ‘id’, // Add primary key here to … Read more