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

learn more… | top users | synonyms

1
vote
1answer
271 views

Rewrite database urls

Is there a query I can run on my wordpress database so that I can change all instances of www.mydomain.com to localhost/mylocalsite.com?
1
vote
1answer
120 views

HTML Entities in Post Title

I'm inserting posts into wordpress using a script which is loaded through CRON. Before inserting each post I am checking whether the post with the same title exists or not. Below is the snippet I'm ...
1
vote
1answer
504 views

Large database causes slow load

I have a 2GB WordPress database (using InnoDB Storage Engine) and I noticed my site loads slow when I press the publish button right after I selected a featured image in the media library. I had a ...
1
vote
2answers
363 views

How to create and work with custom data / tables (i.e., for arbitrary data)?

Getting started on Wordpress just today. I noticed that Wordpress created tables in a mySql database (with name *.wrdp1) when I first set it up. These tables cover comments, posts, users, and some ...
1
vote
2answers
5k views

Get Featured Image via direct sql query

I know you can use the wordpress methods for getting a featured image, however with this particular project I need to get the featured image via mysql query. Can anyone point me in the right ...
1
vote
1answer
553 views

Within the database, where is the flag which says that a user has Super Admin rights?

I have an user in a Wordpress Multisite installation and have access to the Mysql database, I would like to give myself super-admin rights to access the wp-admin/network page. Where can I do it on ...
1
vote
3answers
954 views

Import 10,000 Users into Wordpress WITH a specific ID for each user

I have a website which has about 10,000 users. I am converting this site over to Wordpress. The new site is ready to roll, but I have to bring over all the users. There are a number of plugins ...
1
vote
1answer
517 views

Is it possible to split database tables using HyperDB?

I'm looking for an answer from someone who's implemented HyperDB or has knowledge of it. I have a database which has just passed the 100mb mark a week or so ago, the problem is my host only allows ...
1
vote
1answer
406 views

Disallow categories from this MySQL query

I'm trying to modify a plugin that generates an archive listing so it shows only one category, making it a single category archive. The old version of the plugin used a get_posts query, and so it was ...
1
vote
3answers
325 views

Performance on WPMS

my WPMS site is hosted on 8 cores/32mb RAM server but the response time is very high. We have about 1000 blogs (35,000+ tables on single db) and 70,000 pageviews per mounth. I think that i can down ...
1
vote
2answers
831 views

importing users where password is provided as md5 + much metadata

I have a spreadsheet that was provided to me of users to import to a new site I have built. I was provided with the password in MD5 hash form. I suspect if I insert this into the password field in ...
1
vote
1answer
200 views

WP database error for comments_popup_link()

I'm using the comments_popup_link() function to show the number of comments for each post in a loop. <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if ( ...
1
vote
1answer
635 views

Adding new row to wp_post table

I want to add 2 more rows (for voting up or down) to my default wordpress posts table. Would those rows be deleted when I update my WP version, or cause any other problem? An alternative would be to ...
1
vote
1answer
64 views

Wordpress database error - Error in SQL syntax - I can't identify any error?

I am trying to write function that checks whether an email address is stored in my database or not. I've written the following PHP code:: function check_my_users( $email_address ) { global ...
1
vote
1answer
21 views

Why doesn't this code add a table to my database?

To get to the point, I'm trying to add a database table upon installation of my plugin. Here's my code: global $scimp_db_version; $scimp_db_version = "1.0"; function scimp_install () { global ...
1
vote
1answer
58 views

How to determine what is generating large amount of database queries?

For some reason, my Wordpress site is using a lot of memory (spiking at 72MB) and generating a huge amount of database queries (76923 according to Wp-Memory-Usage. I'm really not sure why this would ...
1
vote
1answer
151 views

Successful or Error Message after running mysql code in functions.php

Just for this article, suppose there is a code that I want to run on my WordPress' functions.php file. It's a code to delete mysql table on my database. For example, here's the code: $wpdb->query( ...
1
vote
3answers
367 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
349 views

Can I use MariaDB instead of MySQL in wordpress?

Is it possible to use MariaDB instead of MySQL in Wordpress installation? If possible: how do I do that? Is there any drawback or complexities?
1
vote
1answer
26 views

For best DB performance should I serialize all theme options together or by type?

If my theme has a lot of options is it better to store all options in one database entry, or to use a databse entry for each group of options? IE would I name all options like this ...
1
vote
1answer
124 views

How to adjust code to refresh a dropdown box with tags that are active on filtered category listing

I have multiple custom tags setup (ptags) and custom posttypes (products) and made it so i can filters posts by multiple tags in a category. Currently the code retrieves tags from posts relating to ...
1
vote
2answers
350 views

$wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies

It's easier if I made an example: I have a custom post type MYPOSTTYPE, with 3 taxonomies TAX_1, TAX_2 and TAX_3 If I have 3 terms: 'TERM_TAX_1' in TAX_1, 'TERM_TAX_2' in TAX_2, and 'TERM_TAX_3' in ...
1
vote
2answers
200 views

Join new table with SQL query

I created a plugin with a new table (wp_soundcloud) and I need to retrieve the data from that new table along with the post data. Here is my query: $querystr = " SELECT $wpdb->posts.*, ...
1
vote
2answers
252 views

Distinction on meta value on pre_get_posts

I've got a special "position" meta field for posts which can be between 0 and 37. 0 Is ignored, and everything else can have obviously any number between and including 1 and 37. But this of course ...
1
vote
2answers
3k 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
3answers
657 views

WordPress Custom Query

I have posts that use a custom field for start date and end date. query_posts returns an array of posts that exist in the category I'm filtering. How do I query posts using this custom field that has ...
1
vote
1answer
780 views

Split WP install between 2 databases?

Is it possible for Wordpress to work from two databases? The reason I ask is that we're approaching our 100mb limit for database size on our host (1and1) but have up to 100 databases, so what I was ...
1
vote
1answer
1k views

Tags to Post-ID mysql query. Tag Search

Im trying to implement a tag-based search. When i specify certain tags, tagged posts will be searched and the post-id will be displayed that matches the searchcriteria. Currently it only works for a ...
1
vote
1answer
362 views

MySql database help for a plugin

I am using a WordPress plugin called MyReview but I want some changes to it. That plugin has feature to review posts, where users will come and give star ratings to the post according to categories, ...
1
vote
1answer
348 views

if statement on database query

Part of a voting script I'm working on: I'm checking a custom table in my WP database to see if a user already voted for a post by checking the IP address and the post id. If the user's IP already ...
1
vote
1answer
19 views

How to find meta entries with their posts missing via SQL?

I'm looking to write an SQL query to do the following: Select all postmeta rows where the meta_value = a post id that does not exist. For example, postmeta meta_value may equal 235. Usually this ...
1
vote
1answer
22 views

I want to select the from values from database in WordPress? [closed]

Here is my code: $sql = 'SELECT * FROM ' . $wpdb->base_prefix . 'item WHERE uname = "'. $_POST['login_name'] . '" '; $result = $wpdb->get_results($sql) or die(mysql_error()); foreach($result as ...
1
vote
1answer
39 views

Wordpress not reflecting changed of the database

my problems started when I moved my website to another folder (from /dev/ to /). I have gone through the whole database in order to change all the hardcoded /dev/ into / but I still notice that ...
1
vote
2answers
259 views

how to refresh wordpress permalink settings? (without admin panel)

I changed permalinks in wp_options table in database and I'm getting 404 on every post. Everything works fine after I log in into the panel and click "save settings" on permalinks options page. How ...
1
vote
1answer
31 views

Migrating from Existing MySQL Setup to WordPress

I currently have a database with the following schema: Table: Articles Columns: ID, Title, Author, Content Table: Authors Columns: ID, AuthorName, EmailAddress Table: Categories Columns: ID, ...
1
vote
1answer
335 views

SQL query to update post_date (one post = one single date & time)

I have 120 posts of one category ready for my wordpress blog. For the moment, posts are drafts and I don't want to schedule them manually. I want to publish them like this: 4 articles each day from ...
1
vote
2answers
187 views

Connect another DB and fetch records from some tables

I want to connect with another wp db & then fetch records from new connected db then close that db. I follow How can I connect to another WP database and use WP_Query? but after connect to new db ...
1
vote
1answer
486 views

Bad Request (Invalid Hostname) on working server, database problem

I have a local server up using EasyPHP. I know its working because I have a default wordpress install running and up on my brower. I have a full site which I also know I have working because when I ...
1
vote
1answer
142 views

Mysql query and order meta value

I made a mysql query to WordPress like this: $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND ...
1
vote
2answers
404 views

Error establishing database connection - high traffic?

I have a WordPress 3.5.1 site that's getting a little bit of traffic (80 concurrent visitors, ~5 clicks/pageviews per second). The site runs fine until it spikes to ~85 visitors. There are usually 4 ...
1
vote
1answer
67 views

Pushing stored procedure to a multisite database in WordPress

I am given a WordPress multisite and need to extract information from the site. I have written a stored procedure that recursively builds a tree relationship for posts of a certain kind. Now I am ...
1
vote
1answer
205 views

Custom MySQL Query with logic

I have wp e-commerce plugin installed and custom building custom global search My query looks like this SELECT * FROM aka_v_posts LEFT JOIN aka_v_postmeta ON aka_v_posts.ID=aka_v_postmeta.post_id ...
1
vote
1answer
74 views

Delete all one-word comments

I'm trying to delete all wordpress comments with only one word. I found this mysql query to delete all comments at once, but that's not what I want to achieve: DELETE FROM wp_comments WHERE ...
1
vote
2answers
533 views

wpdb->prepare function remove single quote for %s in SQL statment

I am using the below wpdb->prepare function in a sql statement. I am passing in several variables some field names and some values. When I try to use the %s for the field name it puts single quotes ...
1
vote
2answers
133 views

How to simultaneously access the same MySQL database in the main column and sidebar of Wordpress?

I've wrote some basic custom PHP code for my Wordpress site. The code basically access a MySQL database (a different database from the wordpress database) and displays the information. In addition to ...
1
vote
2answers
1k views

Is It Possible to Restore Accidentally Deleted Widgets?

I accidentally deleted the widgets without dragging it to the inactive widgets section. I have a backup of all the files and the database but i have changed many things on the site other than the ...
1
vote
1answer
546 views

Help with WP_Query - Too many mySQL queries

I need some kind of help with wp_query. Am I doing something wrong? I am getting a lot of mySQL queries, while building a new theme. My WP_Query is: <?php $args = array( 'post_type' => ...
1
vote
1answer
771 views

Get multiple custom field values in a $wpdb query [duplicate]

Possible Duplicate: How to query posts based on lat-lng coordinate as post meta? I want to create a $wpdb query that select the closest places (custom post type) near the current ...
1
vote
1answer
114 views

how would I create a custom query to get all users, and a related post based on a postmeta field?

I have about 50 users. Its pretty easy to list them all. However they are related to a special custom post type through a postmeta field called wpp_agents. So I need to list Users, but also the ...
1
vote
1answer
758 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'), ...