MySQL is an open-source, relational database management system.

learn more… | top users | synonyms

0
votes
0answers
10 views

INNODB Supports transactions, row-level locking, and foreign keys

When I try to create a table for a plugin (that was dropped in the past) I get the error: #1005 - Can't create table 'database_db.wordpress_popularpostssummary' (errno: -1) (Details…) And the ...
0
votes
1answer
23 views

$wpdb->delete column values IN ARRAY()?

I am wondering if this is possible? $wpdb->delete( 'table_name', array('id' => array(1, 2, 3)), array('%d') ); So, in this situation, it should remove 3 rows at once, and call the ...
0
votes
1answer
12 views

Add commentmeta custom field to every published comment with SQL

I am trying to add custom commentmeta "likes" with 0 as default value to every posted comment. I have this query but I dont see any error there, but still it doesnt work. Can anyone help me to solve ...
0
votes
2answers
23 views

Custom MySQL query to pull out Advanced Custom Fields?

I'm trying to modify the My Wish List plugin so that I can retrieve some custom fields (I'm using the Advanced Custom Fields plugin to create my custom fields in the admin end). The plugin uses the ...
0
votes
1answer
19 views

how to get postmeta info based on multiple categories?

I need to get one meta_value from wp_postmeta and I can do it with one category but I'm having problem when using another one. I have: SELECT wp_posts.ID, wp_postmeta.meta_value FROM wp_postmeta ...
0
votes
0answers
23 views

Cast woocommerce events date meta_value with wrong format in WP_Query

I'm using woocommerce events plugin to sale tickets in a client site. The client wants to display the next 3 events after today in the home page. I have created this code: $args = array( ...
-3
votes
0answers
18 views

Error establishing a database connection on amazon ec2

I'm getting an error establishing a database connection on Amazon EC2. The database is there and I have the right credentials. Here is my wp-config.php: <?php /** Enable W3 Total Cache */ ...
0
votes
3answers
32 views

Can't run database query

I am writing a function to query some information from a custom table in the database. It seems that I am unable to query the database on the field I need. function ch_details_from_id($id) { ...
1
vote
1answer
30 views

Wordpress Database lost auto increment

After rolling back a Wordpress database to a backup version it seems that all the tables lost their auto_increment on the primary key columns. I read on another post this could be to do with InnoDB ...
1
vote
1answer
36 views

Is there a way to get 3+ dimensional array from a single MySql command

For example an array that has all the months, inside each month are all the users registered that month, and details on every user. I could solve it by simply searching for all users registered this ...
0
votes
1answer
11 views

Query does not filter duplicate _sku numbers

I need to find ALL the post_id in table wp_postmeta that has duplicate sku numbers. I did this with following sql query but the query is not complete. Now I get the full list of all products as ...
1
vote
1answer
19 views

Can I transfer a mysql database to another site?

I've been playing around with WP for about 2 years so I know my way around, but I'm kinda new to working with databases. I've been making sites not relying on a database too much. However, I have a ...
0
votes
1answer
16 views

Custom SELECT Query not returning the_title and the_permalink

I have written a code that splits the title of the posts into words and a custom SELECT Query searches each word for the posts so that I could show better related posts under the single post. I have ...
3
votes
2answers
127 views

Search & Remove Specific Shortcode From All Posts

Question Is there a way to remove a specific shortcode, say [print_me] from all the posts where it appears in one shot. And I don't mean mask it or filter it so it doesn't show up while it stays in ...
0
votes
1answer
28 views

WP Meta Query - mixed AND / OR query doesn't work

I am absolutely boggled by this one. I am creating a search function for a property site - simple enough. Simple queries such as max_price, max_beds, rent_or_buy work ok. But I am trying to create a ...
-1
votes
0answers
18 views

Why is it saving multiple rows at once just after login?

I want to save user login time. When I logins it save multiple rows in the table user_logins. Here is the code from my plugin: function ai_save_user_login_test() { global $wpdb,$table_prefix, ...
0
votes
0answers
20 views

upgraded a MySQL 5.1 database to 5.5 and now my wordpress site wont connect

I was upgrading my package with my ISP and they told me to export mySQL database create a new one and import the data via PhpMyAdmin. They neglected to mention that the new database would be ...
-1
votes
1answer
25 views

SQL error #1062 - Duplicate entry '1' for key 'PRIMARY' [closed]

When I want to import database, I get the next error: Error SQL query: -- -- Dumping data for table wp_comments -- INSERT INTO wp_comments ( comment_ID , comment_post_ID , comment_author , ...
0
votes
1answer
15 views

Missing latest posts and options after DB migration via phpMyAdmin

The latest posts and options are not appearing after importing the database. I'm missing all the latest posts and the latest Advanced Custom Fields. The export is from the remote server and import to ...
0
votes
1answer
25 views

Remove Featured Image based on Date

I have an issue I can't seem to fold a solution for. I'm looking for a way to mass remove the featured images of posts older than X amount of days. 150 days is my target but if I can set it to ...
0
votes
0answers
14 views

Database collation and char set issue

I attempted to import my WordPress website from local host to live server online and i get an error #1115: that i have wrong db collation of utf8mb4. So i googled and changed the cllation to ...
0
votes
1answer
32 views

Wordpress Multisite with thousands of blog

I'm setting up a wordpress site where each user will need to have their own blog. My thought was it's the perfect use case of Wordpress Multisite. I've setup it with multisite using Sub-directory and ...
0
votes
0answers
21 views

After Submitting Form Successfully, The Values Not Stored In Wordpress Database

<?php /** * * Template Name: xoneform * */ echo "Welcome to Xone Form"; ?> <?php print_r($_POST); if ( isset( $_POST['submit'] ) ){ $insert = $wpdb->insert( 'wp_xone_form', ...
0
votes
1answer
22 views

Use variable in SQL statement

I have this: <?php $jerseys = $wpdb->get_results("SELECT order_item_id, order_id FROM wp_woocommerce_order_items WHERE order_item_name = 'Mystery Jersey'"); echo "<p>Jerseys</p>"; ...
0
votes
1answer
16 views

Weird characters displayed when importing WordPress MySQL db

I was thinking that it may be the collation, but I have no way of know what the production db collation is. The local one has been changed between UTF8_bin and UTF8_general_ci, to no avail. I'm seeing ...
0
votes
1answer
47 views

Restore woocommerce orders

Recently my server team replaced my database and they put our previous Database . So we lost our order details of one day[particular day] . Now the server team give the backup that contain the lost ...
0
votes
2answers
42 views

How to get Attachments(image) with specific width\height ratio

I need to get attachment images with horizontal orientation. I tried to use Meta_Query but I don't know how to compare two values (width and height) from one associative array that is in wp_postmeta ...
0
votes
0answers
34 views

Query can not search data with space?

I have following code $wpdb->get_results( 'SELECT * FROM '.$device_token_table.' WHERE user_pushtoken="'.$server_method['user_pushtoken'].'" AND user_id = '.$user_id,ARRAY_A ); ...
0
votes
0answers
24 views

Join Wordpress databases from 2 different installs

I'm just now getting into SQL and the core of Wordpress (PHP). So I'm not an experienced WP developer but not intimidated by the tools. But, if the answers could be dummied down a bit would be very ...
0
votes
1answer
27 views

How to add query vars with paginated URLs?

How I can insert some custom url parameters to pagination links? the code below display like page.php?cpage=2 But I would like to add a parameter category with value fruit. So, the final url will ...
0
votes
0answers
31 views

WP_Query order by number of likes

I'm trying to configure WP_Query to order by number of likes. I have a custom table called 'likes', which records which liker (user ID) likes which post: id | liker | post_id 1 | 11 | 120 2 ...
0
votes
0answers
42 views

How to delete a stuck post using phpMyAdmin

I was attempting to change some leftover http:// references in the DB using Update/Set SQL statements. I was getting confident and started doing them in bulk and stopped noting exactly what I was ...
-2
votes
1answer
59 views

Submit cf7 form to cfdb as pdf/BLOB

I have a form created in CF7 with a signature field. I am also using CFDB. Rather than do the usual submit, I would like to capture the form as an image in a pdf and insert it into CFDB in a BLOB. I ...
0
votes
0answers
17 views

WordPress Stored Procedure - Commands out of sync, you can't run this command now

I'm having trouble trying to call a stored procedure for my WordPress plugin. I am receiving the following error: CALL category_GetName(3) Commands out of sync; you can't run this command now ...
0
votes
0answers
49 views

How to create a coupon in the database?

I added over 1000 coupons (schedule ones) in the database. I had one line in wp_posts and several wp_postmeta tables per coupon. To add, I've saw how a coupon was represented there and I've made ...
0
votes
0answers
29 views

How to configure MySQL-SSL-Access to a MySQL Server 5.5 when a list of CIPHERS seems mandatory?

I have a MySQL 5.5 Server with SSL setup. I can connect with my MySQL user via command line from the webserver to the database server over TCP and verified the connection is encrypted. I figured out ...
0
votes
0answers
41 views

SQL Query for all posts in specific category

I try to add a custom field to all posts in specific category with a sql query. This query set meta_value of new meta_key as post_author value in ldn_posts table. Here is begin of the code (works for ...
0
votes
0answers
34 views

How to unwrap/separate Html tags in pages?

I have around 300 pages with some of them having wrong HTML formatting that I have to fix. I want to: Separate the H1 tag from the inner tags. Moving the TITLE (found in span) to H1. Get rid of the ...
0
votes
1answer
51 views

Error while importing database

A WordPress website is created and MySQL is the database for it. When tried to import the database to an empty database via Linux Command Shell we encountered below errors: ERROR 1146 (42S02): ...
0
votes
1answer
31 views

Accessing data from a non-WP database/table within a page content

I'm trying to convert a home built (PHP / MySQL) set of web pages to WP. I've installed the theme I want and have some basic pages working OK. However, I have a set of data within a MySQL database ...
0
votes
0answers
16 views

Database table not created without error

I have this code to run on activation to create the table $table_name = $wpdb->prefix . "codes" function code_install() { $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " ( id ...
0
votes
0answers
38 views

Send data from plugin to external database

I'm creating a plugin that I need write data to an external database (not the wp db that the plugin is on). I know I can use require_once with a separate config file with the external db details in ...
0
votes
2answers
41 views

Using wordpress function to retrieve data

I have been working on open source plugin and trying to add a new feature to it. For now I have been doing like this else if( $selected_report == "greport" ) { $sql = mysql_query( "SELECT ...
0
votes
0answers
19 views

wordpress query between zipcodes not working

Ok, I have this code that checks for zipcodes in the database, normally I can simply do a between query, but the zipcodes are stored in the following way: zip_code::2025 (meta_value in the usermeta ...
0
votes
0answers
58 views

WordPress database error Deadlock found

My website become slow due to this issue. WordPress database error Deadlock found when trying to get lock; try restarting transaction for query DELETE FROM wp_options WHERE option_name LIKE ...
0
votes
0answers
57 views

Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error

This is a bug in my WP install that has crept up unknowingly; I can't say for sure when it began. To describe it: there were menus created in the Appearance -> Menus page early in the site's history, ...
0
votes
1answer
72 views

How to merge local and live databases?

We've been developing for Wordpress for several years and whilst our workflow has been upgraded at several points there's one thing that we've never solved... merging a local Wordpress database with a ...
0
votes
0answers
25 views

Best Way To Merge My Existing Custom User Database With WordPress?

I'm sure this has been asked before though I can't seem to find a clear answer or clear direction on how to handle this. I would appreciate a point in the right direction. I have an existing custom ...
0
votes
0answers
16 views

change data in mysql but don't change in admin

I have a problem, I have changed the content of my page in MySQL, but when I reopen the same page in the WordPress Admin panel, the content hasn't changed why is this? I'm using the interconnect ...
0
votes
1answer
39 views

Do I need to prepare query before get_results(), get_row() and get_var()?

I know that we don't need to use prepare($query) when we put it in insert() and update() because these functions sanitize data for us but I'm not sure if we need to prepare query before putting it in ...