Stack Exchange Network

Stack Exchange network consists of 174 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

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

-1
votes
0answers
14 views

How to insert update delete with current user id in PHP

I want to create a table like this id type make model year warrant in this table i want insert,update,delete with current user id is saved in the databse can any one help me to solve this problem. ...
1
vote
1answer
23 views

Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]

I've been using Local by Flywheel for my local dev environment but recently it started acting weird so I decided, that since I'd finally learned a decent amount of CLI, maybe I should try just using ...
0
votes
1answer
17 views

Show Mysql table elements as pages in Wordpress

I am trying to build a WordPress site, but I need a specific functionality and I haven't been able to find a plugin for it. I'm going to be scraping sites info and posting the info into a DB (this is ...
0
votes
0answers
19 views

How to properly check if a table exists in WordPress Database using Show Tables Query

This query when runs always create logs for Database error. It works fine when table exists, but when it does not it generates the below shown debug logs. Any alternative way to check if database ...
0
votes
0answers
14 views

Ajax duplicate multiple inline data checking from database

I am trying to make a form with multiple same type field (i.e. title) in Wordpress. In that case I need to ensure that no duplicate data is being attempted to insert before the form is submitted. I ...
2
votes
0answers
25 views

$wpdb->get_results() does not fetch results with unicode 'WHERE' clause

I've just a simple query to fetch a students records by his name, written in Bengali. $student_rcrd = $wpdb->get_results("SELECT * FROM student WHERE name='আবুল কালাম আজাদ'"); Although my database ...
0
votes
1answer
13 views

How To Upload Existing WordPress Site To WordPress Multisite Using SSH

I have a WordPress site that needs to move into a WordPress Multisite. I tried to find the site file to upload in wp-content/uploads/sites but I couldn't locate the file. I also tried to upload the ...
0
votes
0answers
20 views

Create WordPress shortcode from database entries

So I want to create a shortcode for every row in my database. The problem here is that the add_shortcode() requires a shortcode, which I can create a variable for in a foreach loop and a callback ...
0
votes
0answers
15 views

MAMP Mac to Windows

I want to transfer my all of ( wordpress ) sites from MAMP server to Window ( probably WAMP/XAMPP ). How can I do that. I have copied all the sites from old server to new server ( web server's root ...
-1
votes
1answer
21 views

Query Concatenation

I can't figure out how to properly concatenate my PHP variables in my MySQL query. $convert_class_id and $convert_char_id are holding numerical values. When I try to activate my plugin I get an ...
0
votes
1answer
35 views

How to use mysql LIKE with wpdb?

as per title I need to use LIKE operator to delete a row on db programmatically with $wpdb. I wanna use $wpdb->delete to remove an occurrency but I don't know how to set the LIKE operator because ...
-1
votes
1answer
23 views

Get all the related data from WordPress DB

I have 2 custom tables inside the DB WordPress is installed in, With one-to-many relation between both tables. Here are the two tables: posts table ...
1
vote
0answers
12 views

Update results, Before deleting the related category [closed]

There is a DB that contains 2 tables posts and categories, Each category could contain many posts, So I'm using one-to-many relation between the two tables. Using the id of the categories and a ...
1
vote
1answer
42 views

Converting MYSQL to WordPress $WPDB

I’m upgrading an archaic Wordpress site from 3.7. It has some SQL query requests that don’t function after 3.9+ where you now have to connect to the DB via $WPDB (https://codex.wordpress.org/...
2
votes
2answers
64 views

How to make WordPress plugin check for database changes and then do something?

How do I for instance check if there is written a new comment in the database and then make my plugin register that there have been a change? I will use this information to do something in the ...
0
votes
0answers
30 views

How can I verify WordPress nonce from the following code?

<?php /** * Template Name: Manage Days */ if ( isset($_GET['remove_date']) && isset($_GET['_wpnonce']) ) { $delete_date = $_GET['remove_date']; $delete_nonce = $_GET['_wpnonce']; ...
1
vote
2answers
37 views

How to get posts on a specific date - WP Query

I want to get posts of a specific date, I tried the following code but I did not get the result what I wanted. <?php $mil = 1532996880000; $seconds = $mil / 1000; $dt = date( "Y-m-d", $seconds ); ...
1
vote
0answers
13 views

Randomised Post Time

I've imported a Drupal site to Wordpress with an archive of 1000s of posts which had been backdated by adding a custom taxonomy 'Year' rather than by adjusting the post date. I've been able to remove ...
2
votes
0answers
29 views

Get the Plugin Which Triggered a MySql Query in Wordpress?

I am currently working on this plugin, which is similar to Query Monitor in which i Have displayed all the Details present in the $wpdb object. Now i need to find which plugin is Triggering the Query. ...
1
vote
0answers
23 views

306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]

I realized that my wp_options table is huge, hitting 473.2 MB, which made me curious. Then I started to run a few queries until noticing that the following query returns 306378195 bytes, or ~306 MB. ...
1
vote
1answer
35 views

Delete all post meta except featured image Using SQL

Please I just migrated my site and I found out that wp_postmeta consumes most of my cpu resources, Is the any Sql code to Delete all post meta except the featured image. I dont want to Use wp ...
1
vote
0answers
37 views

Wordpress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin

I am creating a wordpress plugin which upon activation i create my database table. I have an .sql file which has ~2000 rows of data and i would like to execute it after the creation of my database ...
1
vote
0answers
41 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
119 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
34 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
28 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
15 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
26 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
32 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
25 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
21 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
234 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
26 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
16 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
282 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
19 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
11 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
45 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
3 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
14 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
19 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
79 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
46 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
7 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
31 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
96 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
55 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
41 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
36 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)?