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

learn more… | top users | synonyms

0
votes
0answers
3 views

select permission not working for dynamic table created via stored procedure [migrated]

Inside the stored procedure i created dynamic temp tables with system time. table created with name like this 'temp_ccdata_20140904101131_2' I want to give SELECT permission for some of my SQL Users ...
1
vote
2answers
1k views

Increment value (value = value+1) of $wpdb->update

This sql query $wpdb->query("UPDATE log SET total=total+1 WHERE id='1')"); How do I turn it into $wpdb->update() statement? Ex. $wpdb->update('log', array('total'=>'total+1'), ...
0
votes
1answer
646 views

wpdb->insert multiple record at once

So after I have created the table 'settings-table' i want to add a couple of records to it. This is how I want to do it, not the best way, so I need a better way to do this because I will add more ...
-1
votes
0answers
11 views

How to Import CSV in a Repeater Field [on hold]

How to Import CSV in a Repeater Field(ACF)? I have a list of car with multiple different specification so i want the specification name and size to be added/append in a repeater field. e.g. ...
8
votes
8answers
9k views

How to replace the domain name in a Wordpress database?

I have a Wordpress database which was installed in a development environment... thus, all references to the site itself have a fixed IP address (say 192.168.16.2). Now, I have to migrate that database ...
0
votes
1answer
18 views

How to Import Multiple Values in custom field

I want to know how to import multiple values in a custom field, I am quite familiar in using custom field for single values but for multiple values is what I am having trouble with for example my csv ...
0
votes
1answer
555 views

Create an user on external database

I have wordpress site and a project management system from codecanyon. Here is the link I have disabled registration for users in project managment system, only login is enabled. I need to make users ...
1
vote
3answers
492 views

Site running slow on new server?

I recently uploaded a website to a new 123-reg server on a single WP installation (www.moseleycoachsales.co.uk). I had developed the site on my own hosted multisite environment ...
1
vote
1answer
315 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
13 views

SQL command to export post_content from wp_posts using phpMyAdmin

I'm trying to select all the data from within the post_content column in the wp_posts table in WordPress so I can export/import it into a new database. Somehow this content didn't properly make it ...
1
vote
1answer
173 views

MySQL LIKE not working

It seems MySQL's LIKE operator behaves like a = operator. The following MySQL query returns the expected result (1 entry): $meta_key = '_locality'; $meta_value = 'The Hague'; $post_ids = ...
0
votes
0answers
8 views

Bulk assign Categories by ID

I have several hundred posts that need to be recategorized. I have all categories established and know the category IDs that need to go with every post ID. Some posts need to be assigned multiple ...
2
votes
2answers
311 views

Grouping related postmeta data via SQL query

I am using someone else's WP plugin which stores lots of related data in wp_postmeta using an "artificial key". So effectively we hijack wp_postmeta to create a nested relational database. So one row ...
0
votes
0answers
18 views

Import SQL tables from SQL file on plugin install

I'm building a plugin, on installation of the plugin it needs to create several tables. Now I found out that I can do that in the plugin code sorta like this.. // Function to create new database ...
1
vote
1answer
41 views

Wordpress database import: Row size too large

I've done a dump of my Wordpress database using Windows's command prompt: mysqldump -u username -p databasename > filename.sql Then, on a different server, imported it using: mysql -u username ...
2
votes
1answer
2k views

How to get a Google maps SQL->XML->map marker tutorial to work in WordPress

I have been trying to figure out what is wrong with my code for a couple days now, and I can't seem to crack it. I am trying to follow this tutorial I tried all three of the suggested methods to ...
2
votes
2answers
4k views

How to validate WordPress generated password in DB using PHP?

I am working with site that is done with WordPress, and I need to add some parts that are outside WP, and to check user login, Logging users outside WP. I tried with md5 of password but it's not... ...
1
vote
1answer
18 views

How to prevent/delay MySQL connections when an object cache is used?

We are using an object cache backed by memcached, however I think that WordPress will still connect to MySQL on every page load, which shouldn't be needed if all queries can be handled by the object ...
0
votes
2answers
703 views

Wordpress Custom Query: Combining Two Functions

I'm a bit new to php and am having some trouble combining the functionality of two custom queries in Wordpress in order to (1) get pagination to work properly, and (2) sort my posts according to a ...
0
votes
2answers
18 views

$wpdb->get_var multiple queries in one database check

I am using the $wpdb->get_var php code to get the first name and last name on the records, in the wp_usermeta table... But because the field value is stored in the same cell, I don't know how to merge ...
0
votes
0answers
10 views

mysql full text search wordpress for title

whats wrong in this code. its not working.please help <?php if( is_single() ){ global $post; $specific_u1 = 'sonam sharma'; $specific_u2 = 'akhilesh kumar'; $post_author_id = ...
0
votes
1answer
43 views

How To Make Connection To WordPress Data Base In A Plugin?

I am learning Plugins and I am trying to connect WordPress database wp-config.php in my Plugin PHP code. Currently for checking my code, I used the below connection and it is working fine. Now I ...
0
votes
0answers
15 views

Wordpress MySQL query to add multiple users with related article

What I need is to add 100 users to wordpress and each one should have one post assigned to him, like a profile page (I don't want to use the default wordpress profiles because in the feature each user ...
0
votes
1answer
280 views

Unique Post Meta Values

I want to use Unique IDs like YouTube video IDs and WordPress post IDs in a custom field 'youtube_id'. I just created a front-end add post page and want to check if 'youtube_id' used or not used in a ...
0
votes
1answer
31 views

Using 'mysqli_connect' 'crashes' Wordpress client-side

I am using Wordpress as a CMS for a bus-route planner, I have inputted the first few bus stops for the first bus route and am now developing a PHP script for the planner. I am using this code, with a ...
-2
votes
0answers
31 views

Wordpress Plugin Inserts Demo Data into Custom Tables each time I activate it

i am developing a plugin that creates some custom tables in database. The plugin also installs some default data into database. The issue I am having is each time I activate the plugins, it inserts ...
1
vote
2answers
54 views

Select Multiple meta_value from WP DB; Single Query

I am trying to retrieve each user's first and last name, phone, email, and address from the usermeta table. I'm having trouble selecting multiple meta_values, each with its own meta_key, using a ...
0
votes
0answers
5 views

custom table records not inserted

I want to get all posts and insert all of them into a custom table. But I got an error, saying that all rows in custom table are empty. Why ? <?php global $post; $args = array( 'numberposts' => ...
0
votes
1answer
47 views

How do i append UNION SQL Query with default search query

Example: (SELECT ID, post_status, post_title, post_excerpt, post_content FROM wp_posts WHERE ((`post_title` LIKE '%2020%') OR (`post_excerpt` LIKE '%2020%') OR (`post_content` LIKE '%2020%')) AND ...
0
votes
1answer
820 views

meta_query on a date range using an array of values

How can I do a query to return the post if the custom field array contains a date that is within the specified range? The query below is basically what I am after but it does not work... // the ...
0
votes
1answer
23 views

Multisite Tables the same as Single Install?

Are the tables created for each individual site/blog on Multisite the same as single? Can I do an SQL dump for each MS table and import it to a single install?
0
votes
1answer
33 views

Advanced SELECT query with condtional statements

I am having trouble understanding the proper way to write an advanced select query. I have the following the code here. if (!empty($_GET['3321body_type'])) { $bt = $_GET['3321body_type']; ...
0
votes
0answers
46 views

mysql Join wp_users,wp_usermeta and a custom table

I am doing a search functionality based on three fields: servicename, state, zipcode. I have to filter the users. The servicename is in a custom table named wp_doc_services, while the other two fields ...
9
votes
3answers
608 views

What's a good strategy for planning WordPress DB growth?

Hoping for some feedback on the topic of optimizing and staying on top of performance as a WordPress database grows... to paint a picture.... let's say you have a WordPress / Buddypress MU site that ...
1
vote
3answers
2k views

Convert wordpress posts to products in Woocommerce

Is there anyway I could convert all the posts e have right now on our Worpdress install into products using some mysql query or something like that?
1
vote
1answer
19 views

Moving test theme to live site without mySQL error - how? [closed]

I have installed a wordpress theme on a hidden test site and made some css/design changes. How would I move this to my live site? Sadly I screwed up some of the PHP/MySQL stuff when trying to copy ...
0
votes
1answer
11 views

How to restore: Database intact but folders deleted

I never thought I'd come to having to ask this question -- one trusts web hosting companies to keep our data intact, but somehow they have deleted my entire Wordpress installation while leaving the ...
3
votes
1answer
589 views

Extending search query with additional $sentence value

Next in my quest to extend WordPress is altering how WordPress uses the the $sentence variable in posts_search to include an additional string, when the $sentence variable meets a certain criteria. ...
4
votes
3answers
7k views

How do you properly prepare a %LIKE% SQL statement?

I'd like to use a LIKE %text% statement while still using the WordPress $wpdb class to sanitize and prepare input. SELECT column_1 from `prefix_my_table` WHERE column_2 LIKE '%something%'; I've ...
1
vote
2answers
493 views

Mysql query LIKE not working

I'm using this code. $blog_list = $wpdb->get_results( "SELECT " . $extra . "blog_id, last_updated FROM " . $wpdb->blogs. " WHERE public = '1' AND archived = '0' AND mature = '0' AND spam = '0' ...
0
votes
1answer
38 views

WP_USE_EXT_MYSQL

Here is the constructor for the wpdb class as found in the source code. According to a google search this has been recently renamed from USE_EXT_MYSQL. However I cannot find anywhere in the source ...
0
votes
1answer
62 views

Query to change custom post type with specific category

I need to change several hundred posts with custom post types to regular post type but only from one category within that custom post type. So I have a custom post type 'films' and within that post ...
0
votes
1answer
23 views

Copy wp_postmeta from one database to another

I had a site setup on old-domain.com, which used the database old_db. Recently, we had to migrate our website to a new server and domain, new-domain.com which uses the database new_db. I installed a ...
0
votes
1answer
46 views

How to run this SQL query of wp_terms database

I have the following tables (only pertinent info included for brevity and clarity) Table Name: wp_term_relationships object_id term_taxonomy_id 1266 1341 1266 452 1266 449 ...
0
votes
0answers
28 views

wpdb custom tables without plugin

I am using custom tables, with $wpdb, trying to perform basic queries at the moment. I can't find anything on manually creating tables then using them with $wpdb, everything is plugin related. I ...
5
votes
2answers
102 views

Ordering posts by day (not time) AND meta value

I would like to have a list of posts that is first ordered by day, and then within that day ordered user votes (stored as a meta field). Would it be better to convert each timestamp to the day at ...
1
vote
1answer
19 views

Obtaining user table for one site on multisite set up

I'm trying to select only users that are registered for a specific site on my multisite set up and see that the table for the users has collected everyone that is on the network. Is there away I can ...
0
votes
1answer
36 views

Second completely independent and disposable Wordpress installation in subdirectory?

I know this may have been asked before, but I didn't find an exact answer, so yeah ... I have a wordpress installation in the main directory of my Webspace (hosted @ Strato) and I want to install a ...
0
votes
1answer
32 views

How do post IDs work in WordPress?

So I have 2 blog posts so far and the first one has ID 8 and second one has ID 12. How exactly does WordPress count those IDs? What if I want to change ID 8 and ID 12 to ID 1 and ID 2? I have some ...
0
votes
1answer
45 views

Is MySQL query cache useful for WordPress?

Starting from MySQL 5.6, if you use InnoDB as the default engine, the query cache is now officially disabled. We've a quite moderate traffic WordPress site and experience a major downtime when we ...