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

learn more… | top users | synonyms

0
votes
0answers
7 views

Ajax is running my insert query twice

I am working in WordPress and I run a function to insert a row in database with ajax. Ajax runs but for some reason insert operation is performed twice. Below is my code Ajax jQuery(function ($) { ...
0
votes
2answers
42 views

Add value to array in database

I have a custom database in my WordPress site where I want to save multiple values to one row. Let's say I have an entry: id: auto increment pageid: id of current page time: text (is an array ...
1
vote
1answer
16 views

Are database queries created using WordPress filters protected from SQL injection?

I'm using the WordPress 'posts_where' filter (https://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where) to alter my queries as below: function filter_my_search($where=''){ ...
0
votes
1answer
26 views

Stop my loop to register data twice

I am facing a problem here. The code below is running on my site and when i fill in the form and check my database the data has been registered twice. Please the the following php code from my ...
0
votes
1answer
21 views

Function returning queried meta value based on current post ID

I have written several queries which sums download counts grouped by the post they are associated with, and other relations. They work great for exporting to CSV and other uses outside of WordPress, ...
0
votes
2answers
49 views

Wordpress SQL injection

How to make below code safe from sql injection ... I am working in wordpress. global $wpdb; if($wpdb->insert( 'votes', array( 'votes' => ...
0
votes
1answer
12 views

Get updated query results on page after insert in database

I am working in wordpress. You will see two queries one is select and the other is insert query. I want that after my insert query is run i get updated results on my page. The select query has a form ...
0
votes
1answer
26 views

Connect to MySQL using Windows Authentication

Is it possible to have Wordpress/PHP connect to my MySQL database using Windows Authentication on IIS? I can connect just fine using the normal MySQL command line utilities. I get the following error ...
0
votes
1answer
20 views

Get the id of the row from database on click of a button [closed]

I am using wordpress and I am fetching images from the mysql database with below code. And I display the image and there is a button just with every image and what I want is that when that button is ...
0
votes
0answers
15 views

MySQL: get post_tag items that are tags (not SEO keywords)

I need to extract the post tags from a Wordpress database using MySQL. My current take is this: SELECT * FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id ...
0
votes
1answer
34 views

Can I run multiple queries with $wpdb->prepare?

I have a query(actually multiple queries) that runs perfectly in phpmyadmin, (I've also tried get_var in place of get_results, but I think I might need an alternative to $wpdb->prepare. How can I ...
0
votes
0answers
17 views

Can connect to db normally but I can't select, Access Denied

I have a problem that happened in my website and I don't know how to fix it some data are disappeared and when I debug I find this error WordPress database error: [Access denied for user ...
0
votes
0answers
15 views

WordPress Query Count

So I've used get_num_queries() and the "debug bar" plugin for a while to monitor the number of queries running against the database. Earlier today I turned on the MySQL query log for an unrelated ...
-2
votes
1answer
33 views

If meta_key exists then don't select this post?

I'm trying to select all posts EXCEPT ones with a meta_key somekey. SELECT * FROM wp_posts JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id WHERE meta_key != 'somekey' But this is still ...
0
votes
0answers
51 views

Dynamic data from external database - display in several WP sites

I have looked at similar questions, they don't seem to answer my specific question. I have an external database (not using tables in the WP database). I have several sites that need to pull dynamic ...
1
vote
1answer
34 views

WSoD being caused by this piece of code

This is a function I'm writing which is supposed to post an input along with some other information, to a database. As of right now, activating the plugin produces a WSoD, when the function is removed ...
0
votes
1answer
129 views

Jquery ajax to custom php file: returning blank data

I created a custom php file, put it in my folder. The files does insert some data to the database to a custom table i created. require wp_path() . "/wp-load.php"; global $wpdb; $favorite_table = ...
0
votes
0answers
16 views

How do I transfer an existing website running on Joomla to Wordpress?

I am currently the Admin of a site that is running on Joomla 2.5 and I am looking to migrate existing content to wordpress. Please help.
0
votes
0answers
12 views

Querying sanatized data with meta_query in Wordpress

I asked this question over at SO yesterday, but I see now that this is the right place for it to live. After Googeling this for a while, I've found that this should work cite, but I don't seem to get ...
0
votes
0answers
20 views

Alter wp_post table vs. post_meta performance/speed

I'm searching for the most efficient way to link a post to multiple users. By default each post in wp_post has a post_author column, which is linked to the corresponding user ID in wp_users. Assume ...
0
votes
0answers
14 views

dbDelta not creating tables with composite keys

I've been trying to figure this one out for 3 days now, reading every reference on dbDelta I can find. My ultimate goal is to create a table of unique ad_id, ad_trigger pairs. This does not create a ...
0
votes
1answer
45 views

Wordpress upload images not displaying

Hello I have a wordpress site and I upload images to media library but the images do not display. In wp-content/upload folder there are other folders like 2015/ and then in that folder there are ...
0
votes
1answer
15 views

Custom redirects with using SQL

We have pages with urls like this: http://example.com/?page_id=3&user_id=5 http://example.com/?page_id=6&user_id=9 etc. page_id and user_id located in table MySQL Database. And this table has the ...
0
votes
0answers
20 views

Pages edit as posts

I'm currently dealing with the fallout of the following question (How to change post to page). I got all my pages back though all the pages' URLs were changed so there is no hierarchy and when I try ...
0
votes
1answer
24 views

Converting Posts to Pages

So my site backend had issues and my hosting company had fixed it up for me. In doing that, they inadvertently made all my pages, posts. I'm looking at the database that hosts this and there is a ...
1
vote
0answers
29 views

Set Display Name to first and last name (phpmyadmin SQL Query)

I'm trying to change all the users Display Names to be their first and last name. I have looked into a number of plugins and wrote my own PHP to try and accomplish this however the site has over ...
0
votes
1answer
94 views

Why is converting my database to UTF-8 truncating entries?

I'm running WordPress 4.1.1. My site is hosted at NearlyFreeSpeech. I've been using my WordPress blog since the days when it encoded information in the latin1 charset. This week, I realized that ...
0
votes
1answer
62 views

Wordpress Insert not working with ajax

I am trying to enter insert data with form in wordpress and want to use ajax for that. Without ajax it works fine but when I use ajax pressing the submit button gives 0 in result and the data is not ...
0
votes
1answer
19 views

Widgets with *internal* links do not display after database migration

I am using Grunt to dump my local db, search and replace URLs in it (and account for serialization by using grunt-peach based on Peach), send it to my staging server, then import it into my staging ...
0
votes
0answers
93 views

SQL query equivalent to WP User Query

I have the following WP user query code: //Get all users sorted by whatever $sorted_users = new WP_User_Query(array( 'orderby' => 'meta_value', 'meta_key' => 'satisfaction_rating', ...
0
votes
0answers
53 views

Sanitize a working query string by using $wpdb->prepare() fails with MySQL DB error “right syntax to use near '3' at line 1”

I was using the following properly working query so far: $querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta1, $wpdb->postmeta wpostmeta2 WHERE wposts.ID ...
0
votes
1answer
19 views

Why won't this wpdb get_results query return results?

Having trouble with this query. It returns an empty array even though I know the variables are correct and that multiple rows exist in the database that match. $results_a = $wpdb->get_results( ...
0
votes
0answers
36 views

Using $wpdb (WPDB class) 'replace' with multiple WHERE criteria problem

I have two fields that are used to identify a particular row (acting as a composite key). If it does not exist, I wish to insert a new row. The REPLACE function ...
0
votes
1answer
26 views

MySQL queries in Wordpress

I have a MySQL database table called stock which holds a stock record on items for sale. When querying the database using PHP I have no issue, but when I try to do it through WordPress it doesn't ...
0
votes
1answer
64 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 ...
3
votes
2answers
118 views

Return only Count from a wp_query request?

Is it possible with the standard build-in tools in Wordpress to get wp_query to only return the count of an query? Right now, I’ve a query which has several meta_queries but what the only thing I’m ...
0
votes
1answer
45 views

Wordpress plugin: efficient way to store large data

I have excel file with 1000+ records. Basically it has zipcode and corresponding email addresses. I need to create a custom wordpress plugin which queries this data and sends the mail. It would be ...
0
votes
0answers
36 views

using a function in functions.php to process a form generated in functions.php

so i have a site where users can rate items, it saves their ratings to a mysql db and also tallies the average for the item, saving that as well. as it is a generic function and there are hundred of ...
0
votes
1answer
36 views

SQL error on restoring database

I am running a database backup -- a 7 MB SQL -- using the phpMyAdmin Import function -- and getting an error, whose text doesn't really show where the problem is. MySQL said: Documentation #1064 - ...
0
votes
0answers
56 views

is_user_logged_in() not working after domain change

I am relatively new to Wordpress and I recently moved a WordPress website from one domain to another. I went through and fixed all the links and references that I could find. Now my website has all of ...
5
votes
1answer
142 views

Automatically delete inactive users after 2 months

I am trying to modify this function: // automatically delete users after 7 days in wordpress function wcs_auto_delete_users() { global $wpdb; $query = $wpdb->prepare( "SELECT ID FROM ...
0
votes
2answers
134 views

MySQL database gives blank page (white screen of death)

I am currently trying to migrate a live Wordpress site to a local server to do development. I believe I have done most steps correct, but I am only getting a blank page. I am quite certain that this ...
0
votes
1answer
25 views

Write mysql credentials in plugin

I've to create a custom plugin to print data from a database different from the wordpress one. I'm using wpdb. Is it fine, from a security point, to write database credantials in the plugin files in ...
0
votes
2answers
98 views

Why are no posts showing despite my apparently correct DB restoration?

I restored a backup to MySQL using the phpMyAdmin Import feature. When I browse the DB in phpMyAdmin, I see that my posts are there. But in Wordpress, I only see the default out-of-the-box welcome ...
-1
votes
2answers
935 views

Dynamically populate Cascading Dropdown from MySQL using JQuery/AJAX [closed]

What I'd like to achieve is managing tables in the front-end of a WordPress page the same way as MS Access does. So, I'd like to show dependent cascading dropdown which are related by foreign key and ...
0
votes
0answers
70 views

Update table only if checkbox is clicked

I'm building a little home security project where it should be able to turn the system on/off from a website and by a password on the device. My problem seems to occur with the code from my website. ...
0
votes
1answer
19 views

Help with sorting and storing data on Wordpress

I want to implement something where users can log in and review products and search for products to see reviews. I want to store multiple attributes to allow for really refined searches. I need things ...
0
votes
0answers
18 views

WP Query with multiple posts and meta queries

I have three custom post types: Stories, Venues and Cities. With Advanced Custom Fields I have added a related custom field to each post type. Each Story has a Venue ID and each Venue has a City ID. ...
2
votes
1answer
91 views

SQL query to get adjacent posts from search query

I'm busy rewritting a custom function I have recently written to get adjacent posts according to a tag, category, custom taxonomy term, author or search value saved in the URL I'm using the structure ...
0
votes
1answer
30 views

using same mysql user with many databases

As we know that in order to connect WP with database we should to define mysql username and password in wp-config.php, so at that point i have a question regarding security or ( some sort of ...