Tagged Questions

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

learn more… | top users | synonyms

1
vote
0answers
15 views

Looking for a secure way of storing/accessing user form entry preserving newlines?

I'm allowing users to enter information through a textarea on my site. I'm aware that there is a security risk whenever a user can enter information into a site. I want to be able to preserve ...
0
votes
2answers
34 views

Reset/Reorder posts ID in the MySQL wp_posts table

I have a Wordpress site that is considerably popular. I am in the process of optimizing the site before adding other plugins such as the WPML plugin which I suspect will be using custom post types. ...
0
votes
2answers
30 views

Multiple instance of data in plugin custom database table on plugin activation

I'm creating a plugin that adds some data to a custom table created by my plugin on plugin activations. I also created a settings page with a form that users can insert their own data to the ...
0
votes
1answer
14 views

Getting data from Mysql Table..confusing

I've been pulling my hair out trying to figure out how to do this. I'v created a custom field called cp_country. Now each record in Mysql has a value for cp_country. The problem is i don't understand ...
0
votes
0answers
10 views

Adding a Custom Taxonomy Term to sql union query

There is a beautiful solution to getting the next 3 posts before and after the currently viewed post solved here. However, I would like to narrow the query to just a specific taxonomy term in a custom ...
0
votes
2answers
33 views

How can I add a user through SQL?

By mistake I just ran this query: (note the extra ;) DELETE FROM wp_users; WHERE ID = 321; How can I add a user through SQL? I searched around but couldn't find a proper answer to this fairly ...
0
votes
1answer
57 views

Delete all subscribers from wp_users and wp_usermeta a few thousand at a time

I have a site with 70K spam subscribers, and I don't need any of them. So I need to delete all subscribers from wp_users and each user's associated meta from wp_usermeta using a query in adminer ...
0
votes
0answers
17 views

Shop coding dynamic permalinks & titles

I have built a shop application using php and mysql and wasn't sure how to add it to wordpress but I had a stab at it anyway, I managed to get it to function fine but because the pages are dynamically ...
0
votes
1answer
24 views

How to sort results from a custom database table

I've created a custom WordPress database table which I'm using to store 'likes'. The columns I have are: id post_id user_id I'm now trying to get an array of post IDs that a particular user has ...
0
votes
1answer
28 views

Brainstorm - Slow Query from Plugin Need to Speed It Up

We use WP as the backend for a business directory. I have a plugin that queries based upon location coordinates looking for the closest 10 locations to a given "listing". This query is really slow ...
-1
votes
2answers
29 views

Trying to insert a row from a Plugin

<?php require_once("../../../wp-includes/wp-db.php"); wpdb::insert( 'wp_options', array( 'option_name' => 'data1', 'option_value' => 'data2' ) ); ?> I have this code ...
0
votes
0answers
31 views

Install will not load: PHP does not have MYSQL installed

I'm having trouble installing Wordpress on my Windows 2008 R2 server. I'm getting the message: Your PHP installation appears to be missing the MySQL extension which is required by WordPress. To ...
0
votes
0answers
31 views

`#1215 - Cannot add foreign key constraint

create table wp_pageviews ( ID BIGINT(20), count integer, primary key(ID), FOREIGN KEY (ID) REFERENCES wp_posts(ID) ) Error : #1215 - Cannot add foreign key constraint ...
0
votes
1answer
26 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
0answers
26 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
196 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
16 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 ...
0
votes
0answers
32 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
28 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
24 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
12 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
69 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
20 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
41 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 ...
1
vote
1answer
97 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 ...
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
68 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
31 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
45 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
62 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 ...
1
vote
1answer
21 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
67 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
16 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 ...
1
vote
2answers
81 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
1answer
92 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
65 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
1answer
41 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
0answers
48 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 ...
1
vote
1answer
25 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 ...
5
votes
2answers
120 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 ...
0
votes
1answer
47 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
34 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
0answers
85 views

Add delete/edit button to each row in an SQL table (Wordpress Backend)

I have a form that is submitting entries to a table in the backend of my Wordpress installation. I would like to add edit/delete buttons to each row so that an administrator can delete submissions or ...
1
vote
0answers
27 views

Problems accesing my site [closed]

I was building a new site with WP, but when I checked it with various servers on http://www.host-tracker.com/InstantCheck, most of the request are returning with a 503 error. In addition my memory ...
0
votes
0answers
21 views

Check role in database

I'm developing a script outside of Wordpress that needs to work with the Wordpress database and our website. I just need to check if the role of a user is our custom role (already defined) of ...
0
votes
1answer
26 views

Making CURDATE() recognize current_time()

I'm trying to make this query pull a list of users 30 days from today that have a birthday. This query works as per below in WordPress, but excludes those who have birthdays as today. I believe the ...
0
votes
0answers
20 views

Database solutions for a commenting plugin?

(I'm new to this and am aware that my questions are vague and kind of suck, please bear with me.) My plugin, a commenting platform, is in the directory. Currently, it doesn't have it's own database. ...
0
votes
0answers
18 views

Close secoundary database connection

I have two website. first one is in wordpress and second one is in corephp. My Question is that i am connection database by $wpdb. /* Core php database */ $newwpdb = new wpdb( 'username', ...
0
votes
0answers
15 views

Incorporating a meta query into a mysql query in wordpress

I'm trying to find a way of inserting a meta condition into this bit of SQL below... $query = "SELECT COUNT( ID ) as num_events " . "FROM $wpdb->posts " . "WHERE ...
0
votes
2answers
49 views

get_results suddenly not working on a single table

I'm trying to get a list of rows from the DB. All tables work except the one I need. No errors are thrown, don't even get a blank array. My SELECT statement works fine in phpmyadmin directly, but not ...