Questions tagged [mysql]

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

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

A $_POST should occur when submit form but is not?

When I make a modification to data that is read into a form using MYSQL, I want to apply those changes to the database. But even when successfully submitting a form, the $_POST values are not ...
0
votes
1answer
36 views

I can't update my data through $wpdb

I am trying to update my sql data through $wpdb, but can't... If anyone can help what's the real issue? $updated_version = $wpdb->update('wp_visitors', array('views' => $updated), array( '%d' ))...
0
votes
1answer
26 views

Trouble running $wpdb->query() with last_insert_id

I am trying to get a primary key from a coupon table to put it in my target table as a foreign key. In between I would like to run a query to get the last insert id. I can't get the syntax right ...
0
votes
1answer
899 views

Update post meta data (custom field) by post link

I have a post in my WordPress website, which has lot of custom fields. I have an Excel sheet with "post link" - "custom field data" combination. That custom field (video URL) is already set for each ...
0
votes
1answer
928 views

wp_insert_user is not working for me?

I have written a code for inserting wordpress user if I try to add new user I am getting an error for wp_insert_user like below : "Catchable fatal error: Object of class WP_Error could not be ...
2
votes
2answers
1k views

Gaining Login Access via the Database

I have been given a job to amend a Wordpress site. I have only been given access to Cpanel. My questions are can i log in to the back end of Wordpress via Cpanel? If you can't login via Cpanel can i ...
0
votes
2answers
2k views

Change woocommerce product type in SQL from simple to variable

Recently had to start my website from scratch. Installed all the plugins and then restored the database. My products were all variable products (swimsuit sizes). And now they are all simple. I ...
0
votes
0answers
9 views

avoid duplicate content after migration

I've done a full migration of two wordpress site (transferring bunch of blogs). I see that there are few blogs that have been repeated twice. Like, after moving old blogs from old to new sites along ...
0
votes
1answer
1k views

Delete duplicate record in wp_postmeta

Some of my posts have two values for a meta key called cb_full_width_post. I want to only keep the records that have a meta value of nosidebar-narrow. This means I need to Identify records in ...
3
votes
1answer
64 views

Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

My client's website is moved from http to https, and I have updated most of the URLs using queries in phpMyAdmin, but I have been unable to update shortcode URLs. I have used the following query to ...
1
vote
1answer
893 views

Term and sub term from custom post type query

I have created a custom post type and taxonomy for a goods catalogue for a hire website. This works fine. I am trying to generate a report that lists all items and their category and sub category. I ...
1
vote
1answer
12 views

How can I perform high-level database merging for WordPress within continues delivery?

I've a bit of a problem. I'm currently trying to realize a WordPress development process regarding to one of my old question / topic: https://stackoverflow.com/questions/48890019/wordpress-...
1
vote
1answer
1k views

How to get last updated row or ID in wordpress

How to get last updated row or ID in wordpress. Like : $wpdb->insert_id;
0
votes
1answer
20 views

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

I am trying to get all data fields name and data types from an array, but the query is not working. <?php $cr_table_array = array( array( 'data_field' => "id", 'data_type' => "mediumint(12) ...
0
votes
1answer
31 views

update_option returns false in AJAX, how to debug?

I tried debug plugins for WordPress, but they only show the current page SQL queries. How to debug if update_option returns false? I am updating an object decoded from AJAX request with json_decode ...
0
votes
0answers
27 views

How to show galleries from a specific NextGEN album ID inside a custom WordPress page template?

I have a WordPress page template where all NextGEN galleries are displayed on a page: <?php global $nggdb; ?> <?php global $wpdb; ?> <?php $galleries = $nggdb->find_all_galleries('...
0
votes
2answers
1k views

How to optimize 'select found_rows()' query? Several 'high load average' alerts daily

I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies ...
0
votes
0answers
7 views

WordPress, WooCommerce wp-admin BackEnd work speed of response issue

Product Uploading: Limited by uploading 1000 products per instance, if more the process is freezing. The more uploaded products a vendor has the slower new products uploading speed. Product Uploading ...
2
votes
3answers
2k views

Removing the first image in content

I've been using this code: function remove_first_image ($content) { if (!is_page() && !is_feed() && !is_feed()) { $content = preg_replace("/<img[^>]+\>/i", "", $content, 1); }...
0
votes
1answer
39 views

WordPress insert query is not working : Showing no Error

Can`t insert data of form into the table, I have also tried other ways. Below is the code. <?php /* Template Name: The custom email */ ?> <?php get_header(); ?> <?php $sql = "CREATE ...
0
votes
1answer
24 views

How to get INSERT errors from $wpdb?

I have these $wpdb->suppress_errors(false); $wpdb->show_errors (true); $wpdbp = $wpdb->prepare($preparedQuery->query, $preparedQuery->values); $result = $wpdb->...
0
votes
0answers
11 views

Character encoding issues on some text

I transitioned a website over to another host. I am having issues with the database. It is encoded in latin1 I believe. Here is the table: However, on the post excerpt, the text looks like this: ...
0
votes
2answers
782 views

You have an error in your SQL syntax - Help with query

I have a programmer that developed a custom plug in for a client's website and after moving the site to client's server, some parts are not working. Looking at the error log, there is an issue with ...
2
votes
1answer
90 views

Get WooCommerce product details and transfer them to a custom DB table

I'm currently doing a registering service for products with WordPress and WooCommerce. All products that customers can register will be in the WooCommerce database, but not visible on frontend. Here ...
0
votes
1answer
43 views

SQL query to bulk change short code in all posts

PHP/SQL noob here. Based on this question I attempted to change some entries in phpmyadmin for my wordpress blog: I want to all galleries to link to file instead to file attachment (add link="file" to ...
1
vote
2answers
269 views

Wordpress Backend HA (Automatic failover)

Out setup is multiple Front Ends (replicated) and 2 Backend MYSQL servers (Master-Master replication). We're looking to achieve HA automatic failover for wordpress. We've got the front ends covered ...
1
vote
2answers
158 views

Create Pages from Database

i've recently decided to create a website with wordpress. My goal is to a visualize data stored in a MySQL database. Each id in the database should represent one page on the website. From what i've ...
8
votes
5answers
13k views

Checking if Database Table exists

I read the wordpress codex and professional wordpress. It seems both use something like if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { to determine if the table exists. Is ...
0
votes
1answer
25 views

Delete all user's meta without knowing all the 'key'

Trying to delete users from the frontend - which I currently have working. Previously, I was manually deleting the metadata when it was completed. I was looking to see if it was possible to delete ...
0
votes
0answers
18 views

WordPress User Search Based on Latitude and Longitude

I am working on a project for myself whereby I am trying to search users within the WordPress database based on postcode/zip and radius but the code which I'm using takes forever to load and results ...
0
votes
1answer
408 views

The function is deprecated; use mysql_real_escape_string() instead

I don`t know coding. I recently my website stop to work properly. I get this error on the top of on every page loaded. Deprecated: mysql_escape_string(): This function is deprecated; use ...
0
votes
0answers
8 views

Woocommerce web site 6-7 second pageloads

I have a wordpress based ecommerce website with Woocommerce. I use WP-Rocket Plugin for cache I use CND I use a Cloud dedicated server : 9CPU X 2GHZ 7GB Ram Apache For cached page ...
1
vote
1answer
463 views

MySQL variable in query

I've got tenant portal when I need to show running balance for each transaction. Here's query I've written which does what I need it to do. Problem I've got is that it doesn't work in Wordpress. Here'...
1
vote
0answers
21 views

How can I save unique user data on my site? [closed]

I am trying to find a way to allow registered users on my site create lists of data and save them. I'm having trouble finding a way to save the list they create to the database of my site. I am ...
1
vote
2answers
31 views

Removing a wordpress multisite installation and preserving the database before migrate to nginx

I have a WordPress multisite installation, and I need to remove the multisite, and keeps just the site ID 5 (domain.com/br) in the main address (domain.com). So I follow this tutorial to remove ...
0
votes
1answer
21 views

I would like some help wth an SQL query to link posts with categories

I am extracting data from my Wordpress database to analyse site structure. Works pretty good so far but I would like to include the posts main category in the table to enable further analysis. This is ...
0
votes
0answers
38 views

Wordpress Query optimaization for slow query

I've WP installation with some 120K posts. One of the slow queries that frequently appear at @mysql-slow.log is below # Query_time: 1.744827 Lock_time: 0.000567 Rows_sent: 1 Rows_examined: 635732 ...
0
votes
0answers
34 views

how can i solve this problem? “wp_termmeta' doesn't exist for query SELECT term_id, meta_key…”

I do not know much about DATABASE. I am just a blogger. Two weeks ago, my blog is totally fine. but when I tried to pots new post, or when I tried to open existed post on homepage, I cannot post, or ...
0
votes
0answers
39 views

autocomplete in wordpress using ajax with json-data

The scenario is whenever client press the key, automatically the suggestion should come below the text box, and that suggested value is fetched from the database. Here i am stucked in a situation ...
0
votes
1answer
489 views

Merging development site with live site

Earlier this year I built a client a large website for their organization. After that site was finished and live on the web (not on our development server anymore) they wanted the company I work for ...
1
vote
1answer
435 views

PHP script can't connect to Database on port 3307

I can connect to mysql just fine with my port number through the command line like so: mysql -h ##.##.##.## -P 3307 -u wpuser -p I have a php file that tries to connect to the DB, <?php ...
0
votes
1answer
438 views

Deprecated: mysql_connect():

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/gorilla911/public_html/wp-includes/wp-db.php on line 1520 ...
0
votes
1answer
328 views

Hacked Wordpress website /Homepage redirect

I am very sorry about the length of the post, please bear with me as I am going to try and list everything I've done so far. I am dealing with a hacked WordPress site which had been left without ...
0
votes
2answers
57 views

Way to bulk make all my tags lowercase?

Is there a way in mySQL or otherwise to bulk convert all my tags into lowercase? Thanks!
0
votes
0answers
33 views

MYSQL SQL syntax error on Wordpress Posts page

I see the following error on my Wordpress Posts page when I enable debugging. I only noticed this when I started adding categories to my posts and they were not saving. I never used categories before, ...
4
votes
5answers
12k 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 ...
0
votes
1answer
58 views

Error inserting into custom table - Object of class wpdb could not be converted to string [closed]

Getting the above error when trying to insert into custom table .I am unable to find out what is the cause of the error. The error comes at line 17. Any help is greatly appreicated. The code is ...
1
vote
0answers
63 views

How to delete all customer user account that haven't placed a single order?

Recently I've had an influx of spam users registering on my Wordpress website and I am trying to delete them all if: they have a "Customer" role haven't placed at least one order before As I could ...
0
votes
1answer
38 views

Delete Users without a First and Last Name

I need to clean a WordPress Web site of SPAM users. I checked the Users list and noticed that valid users have a proper Name listed; SPAM users do not have that value and a - is displayed instead. ...
0
votes
1answer
30 views

SQL query to delete users with multiple meta keys and comments

I need help putting together an SQL that can delete users if they don't have (metakey1 or metakey2) and (does not have comments) I have this SQL which does it for single meta_key SELECT * FROM ...