Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mysql]

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

2
votes
0answers
211 views

Error: MySQL shutdown unexpectedly. XAMPP local conf running WordPress

I have a xampp configurated locally to run wordpress. I must have done something wrong when fixing some issues 'cuz at the end, I got stuck with the following log from mysql database. 2015-11-10 15:...
2
votes
1answer
140 views

Is the regular ajax request method safe or I should use admin-ajax.php?

On the homepage I have some links: <a class="link" data-id="1">first link</a> <a class="link" data-id="2">second link</a> <a class="link" data-id="3">third link</a>...
1
vote
1answer
66 views

Modify MySQL Query Based on Dropdown Menu

I would like to be able to modify a MySQL query based on the selection in a dropdown menu. This would then update the subsequent table shown on the page. The current code I have is below (note I'm ...
0
votes
1answer
175 views

Ideas how to search & replace post_content when string contains a newline?

I've previously been able to search & replace using the very helpful "Search & Replace" plugin for wordpress but now i've came across a problem i cannot solve. In table wp_posts i want to ...
0
votes
0answers
21 views

Searching through database table and posting results

So, I have looked at this link here Creating a search form for custom fields and I think this is pointing me in the right direction. However, I am wondering how I would pull them from a database that ...
0
votes
0answers
118 views

HyperDB: How to display MySQL table data from external (non-default WordPress) database

My goal is to display information from an external (non-default) WordPress database using HyperDB. At this time information does not display in the generated table. Could someone provide an example ...
0
votes
1answer
358 views

SQL query to set posts in bulk based on the post content

I have thousands of offline links in my posts, and I'd like to set them all to draft. I know the links are in the format example.com/fileX. So I needed a SQL query to search the post content and ...
0
votes
0answers
39 views

Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies

I have 4 custom taxonomies that are associated with a custom post type "procedure": "vehicle_year", "make", "model", "axel_type". I've built a dropdown that is dynamically populated based on the ...
2
votes
1answer
271 views

Get terms of posts with category with sql

I have a taxonomy of type and a taxonomy of category. How can I return a list of every type term of posts in a single category? I know I can do this: // Final array of all types: $...
0
votes
1answer
3k views

Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”

I am using wordpress 4.9.6 with mysqlnd 5.0.12-dev as db. I have created my own tables which uses post_id as a Foreign Key Constraint. When I want to delete a post in my backend I get: WordPress ...
1
vote
1answer
77 views

WordPress database error for query INSERT INTO

I am trying to insert data into a custom table. I am using a mysql db with phpmyadmin in my backend. However, I get the following error: [28-Jun-2018 19:36:05 UTC] WordPress database error for query ...
1
vote
1answer
34 views

How to get related tags based on a category?

To better explain my question, there is an example: I have 3 posts, all of them have category "Tech". Post A is tagged with "Google". Post B is tagged with "Facebook". Post C is tagged with "Google"....
0
votes
0answers
1k views

WAMP SERVER Command Prompt SET PATH=%PATH%

My WAMP SERVER will not connect to website in wamp server after I went to command prompt and typed in PATH=%PATH% is there any way to revert this??? I'm an idiot I admit it.
1
vote
1answer
172 views

How to add and SQL query of posts only published

I have a notification on a menu item and need to change the number on the notification. I'm missing an argument of show only "Published" posts. Right now it's pulling in everything in draft too. Here'...
0
votes
0answers
12 views

Why can't I use Kanjis on permalink? [duplicate]

I've already read the 'What topics can I ask about here?' section but I'm still not sure if I can ask this type of question here, so here it goes. I'm starting a blog about the Japanese language. I ...
0
votes
0answers
146 views

Return post_id from DISTINCT meta_value filter

I try to select DISTINCT meta_value and return the post_id of it: $query = $wpdb->prepare( "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s", $key); This is return ...
0
votes
0answers
11 views

My site getting stuck in wp_posts / wp_postsmeta these tables are MyISAM

Hi my site keep getting stuck and then i must reboot some tables are getting lock and stuck i trid APC. Ngnix, Delicated server,memcache,w3 total cache but nothing works site getting stuck randomly
0
votes
0answers
85 views

Insert data from form to database

Hello people on this forum! I have a question, I need to insert some data from a form that I created to the database , I have tried this code: if (isset($_POST['submit'])) { global $wpdb; ...
0
votes
0answers
38 views

Mysql query - amount spent by customer

I am trying to write a query to pull amount of money spent by each customer. I have not been able to find anything searching the site. Thanks in advance!
0
votes
0answers
14 views

append data to mysql table via submit button coded in php - not working

I have a form in the woocommerce account side which should append new entries to a custom table I have added. However, I cannot figure out WHY when I press the submit button ... nothing happens. What ...
1
vote
1answer
488 views

Sum the total amount of a specific product purchased per user and display in table

I asked this in Stackoverflow but figured this would be a more specific domain to answer my question... I have a large mysql table (in woocommerce) where people can purchase items more than once. My ...
0
votes
1answer
234 views

How to create index (sql) to a meta_key?

I am new in programming, and the sql is absolutely stranger for me. I create today a new meta_key on my multisite, but when I use this in a query, my site will be horrible slow... I read (here: https:/...
1
vote
0answers
9 views

Ordering users by custom user meta

I have a list of users, and I would like to select a few to appear at the beginning of the "faculty" page, and then display the rest afterward in alphabetical order. With the following code (...
0
votes
1answer
182 views

Add value to usermeta without removing previous values?

How do I add a value to the key dismissed_wp_pointers without removing the existing values (if there are any). Doing this will put the value there, but it will remove everything existing first. ...
0
votes
2answers
305 views

$wpdb->query doesn't accept query with multiple statements separated with a semicolon, but phpMyAdmin accepts this query

I call $wpdb->query() on a query like INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 0); INSERT INTO wp_ctt_timetables (name, homework, tod, ...
1
vote
1answer
204 views

Remove one value in dismissed_wp_pointers?

I use admin pointers to show a "tour" of the dashboard. And when the user has taken the tour and pressed the Close button, it saves a value in 'dismissed_wp_pointers' under the specific user in '...
0
votes
1answer
89 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
1answer
455 views

How to add 2 hours to the wordpress time formed with current_time(“mysql”, false)?

How to add 2 hours to the wordpress time which has already been formed using current_time("mysql", false)?
1
vote
1answer
78 views

How to connect to AWS RDS external database (not for the core WordPress db)

I'm trying to connect to an external database on AWS RDS to display data from the external database in WordPress, using a plugin I'm writing. My only issue is connecting to the external database and ...
1
vote
0answers
82 views

Emojis getting converted to “?”

Emojis in posts and comments on a 500+ posts blog get converted automatically into single question marks in irregular and untraceable intervals. The respective tables wp_comments and wp_posts are ...
0
votes
0answers
18 views

New database entry to trigger runing PHP/SQL query through link with token, without logging into the website

I want to do particular verification process for my wordpress users, and I want to know if it is even possible, before I spend any more time trying. This is what I have in my WordPress so far. My ...
0
votes
1answer
26 views

next comment id number wordpress

I have removed many spam comments from my very old blog (over 3500 spam comments) and purged from the database. Last comment ID was 3620 after removal latest comment has ID 853. New added comment ...
0
votes
1answer
75 views

Pull MySQL data from multiple tables and merge into 1 PHP array

Appreciate help in advance. I am dealing with a bit of a pickle with a formula. I am trying to create a page template that will display a list of users, specific metadata from usermeta table + ...
0
votes
2answers
30 views

'posts' table should not store the absolute image path

I'm having some difficulty in making a sandbox from a website, and one of them is that wordpress is registering the absolute path of the image in posts.guid field: http://example.com/path/image.jpg ...
0
votes
1answer
86 views

Deleting a table row through query

At this moment i am trying to modify this plugin that deletes table rows to delete ONLY rows that don't contain the word "Cekanje" in the column "Status", this is the code and the solution i am trying ...
0
votes
1answer
432 views

Query Column of Specific ID from Database Table

I am trying to display a particular value from the WordPress database for a specific ID with no such luck. I am not receiving any errors, but just an empty result. Here is my table: table name: ...
0
votes
1answer
101 views

OR condition not working

I am using the following code to search some data from WordPress database, but when first condition is false then OR condition is not working. $where .= ' AND ((' . $wpdb->posts . '.post_title ...
0
votes
1answer
107 views

Query postmeta based on meta_value, return array of post_id

I'm trying to retrieve an array of post_id from postmeta where the meta_value matches some value. In MySQL the query would be something like this: SELECT post_id FROM azEw_postmeta WHERE meta_key='...
0
votes
1answer
13 views

Dev and prod on the same database- dev version active for IOS

I'm looking at a problem on a WordPress site I didn't build and the company that did are no longer operating. The site is fairly basic with no user membership this etc etc. The site holds all its ...
0
votes
0answers
73 views

Use the loop to check if DB record exists?

I have a somewhat unorthodox (i guess) question. I have a function that adds a records to my MYSQL DB, with location lat and lng info. However sometimes that function is not working correctly, causing ...
0
votes
1answer
25 views

Change default login auth

I am going to enhance my WordPress authentication page. My idea is simply, is just change the process to check password, like the default process login with username or email. I've change the ...
0
votes
0answers
320 views

403 Forbidden home on localhost with nginx server

I install wordpress in nginx server on my localhost using debian OS, install is normally. But I only can login to my dashboard using localhost/statistik/wp-admin/index.php not in localhost/statistik/...
0
votes
1answer
115 views

Can't Query Custom Table Using $wpdb Method

I created a custom table for my Wordpress site using Sequel Pro. I am then trying to query the table from Wordpress PHP file using $wpdb method. While I am able to run a successful query using the ...
0
votes
1answer
51 views

Copy usermeta value where ID matches in the same table

I would like to copy the meta_value from row to another (in the same table) where the user_id matches. Each user in the wp_usermeta table has a meta_key/meta_value pair for first_name and a meta_key/...
0
votes
2answers
37 views

string literals in query

I am trying to hack together something in mySQL to allow me to change from one plugin to another without having to do manual data entry for all of my products on my woocommerce store. The goal is to ...
0
votes
1answer
27 views

Trouble migrating custom post types from non-wordpress cms

I am working on migrating over some custom post types from a non-wordpress cms that we will call "shows." I am using a script in functions.php to try and accomplish this, but I am having trouble. I ...
0
votes
2answers
27 views

Making a query to the DB using same parameters of loop

So, I have a loop that works great. But I need to count how many posts that loop has, and I need to do it via a query to the DB. My loop looks like: $adsArg = array( 'offset' => $...
0
votes
1answer
175 views

SQL query : Select a thumbnail for a media

I'm doing a custom gallery for a portfolio page in a website and It works well if I simply use the URL of the media uploaded this way : SELECT * FROM wp_posts AS p INNER JOIN wp_postmeta AS m ON p....
1
vote
1answer
271 views

Enabling WP_USE_EXT_MYSQL to support old plugin

We recently did a major WordPress site upgrade (3.7.25 to 4.9.4 - yes, probably shouldn't have waited this long). I set up a test environment first and thought there would be no issues. However, upon ...
0
votes
1answer
210 views

Queries take 120+ seconds on my large Wordpress site

i have a couple of Wordpress website running on a VPS, each one of them has 1M+ posts. When adding new posts queries just hangs for a long time until the website crashes. I use XML-RPC to post to my ...