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

learn more… | top users | synonyms

0
votes
2answers
953 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 ...
1
vote
2answers
3k views

query users by role

I have a custom plugin which queries users and usermeta, but I now need to filter admins out of the results. A very simplified version of my sql query is: SELECT * FROM usermeta LEFT JOIN users ON ...
0
votes
1answer
40 views

Help me filter get_adjacent_post

I'm not keen on private posts interspersed with published posts on the front end, so I'm writing a plugin that seeks to segregate and separate them out. As part of this I want to modify the post ...
0
votes
1answer
70 views

Buddypress avatar image in database [closed]

I want to get path of buddy-press profile pic directly in database to be used on other then word-press platform but i am not able to find it in database.. because i can't use buddy-press functions in ...
4
votes
2answers
2k views

Searching users with WP_List_Table plug-in

I am trying to devlope a plugin that will search and return my users so I can edit some other metatdata that belongs to them. I have been using the plug-in listed on the Codex as my starting point. I ...
1
vote
2answers
77 views

PHP code inside shortcodes

Basically, I have this line of code: <?php echo do_shortcode('[O_U user_name="operator" blocked_message="This page is restricted for guests."] **Content Goes here** [/O_U]'); ?> Now, inside ...
4
votes
1answer
64 views

How to define composite keys with dbDelta()

I am getting error while trying to create a table with dbDelta() and composite primary key. The sql is pretty straight forward. $sql = "CREATE TABLE {$wpdb->prefix}voicemail_call ( user_id ...
0
votes
0answers
95 views

update_user_meta and wp_update_user not working

I have an array of users that I've successfully updated as described here foreach ($users_out as $key_u => $value_u) { $user_id = $value_u['writer_id']; $user_login = $value_u['username']; ...
0
votes
0answers
95 views

Getting invalid user ID error when creating a new user with wp_insert_user

I'm trying to insert users into wordpress from a foreign database and I've prepared my $userdata as foreach ($users_out as $key_u => $value_u) { $user_id = $value_u['writer_id']; ...
0
votes
1answer
41 views

Is there a page length limit?

I am developing a site and it has 4k lines of content for some of the page (this is when you view source). It is in WordPress, however, I can't seem to add anymore content. It doesn't even respond ...
4
votes
5answers
14k views

Will it break my site if I delete all transient records in wp_options table?

My site currently has an outrageous 500k+ transient records in the wp_options table. This causes the table to be crashed frequently and so be my site. I thought transient records will all expired ...
0
votes
3answers
131 views

Same option_id=0 for 2 options in wp_options?

What does it mean when (according to mySQL Workbench) 2 options have option_id = 0? Just noticed this for unrelated plugin and theme holding very different options. Update Just noticed over 200 ...
0
votes
1answer
1k views

$wpdb->get_var - What value is returned when zero records are found?

I have the following code: $queryPermission = $wpdb->get_var( $wpdb->prepare("SELECT Active FROM testers WHERE user_id = '$user_id' ")); ...
1
vote
1answer
41 views

$wpdb to insert html form information

I'm trying to insert posted variables from a form. When I shorten the amount of variables I'm inserting it will sometime pass the information in my mysql database. Once I continue to add on ...
0
votes
0answers
29 views

Find page metadata in database

I want to insert metadata to custom fields (from "advanced custom fields" plugin) manually (with wp_update_post_meta). I need to know how the meta value strings look like so I can insert this kind ...
0
votes
3answers
262 views

MySQL query in Wordpress with AJAX

I have a search form which searches the DB and returns back some data. I have managed to use Wordpress wpdb to connect and use select statement on the table and retrieve data. Everything works ...
1
vote
1answer
64 views

Delete all post meta except featured image

My aim is to clear up my database entries. I did a migration from blogger which added many useless post_meta. I found a plugin (db reset) that has the option to reset/delete all post meta. However if ...
-3
votes
1answer
72 views

Does anyone know what the wp_snp_stats table is? Maybe I was hacked?

Nothing is pulling up in Google. I've got a good handle on all my plugins that create custom tables. If you're familiar with this table, please let me know. Or else I have a long road ahead. Thx
3
votes
1answer
71 views

Converting mysql to $wpdb

I'm trying to convert this to using a $wpdb class. It will return all the enums possible and i have to use this $wpdb due to mysql_query giving me weird error (no database selected) Code is following ...
0
votes
1answer
89 views

Sql - Search with serialized Data / better database concept

I know this question was already answered. But I hope someone can help me in my specific Problem. I have a custom Post Type. For this Post Type the user can declare 1 to X Datetime ranges with a ...
0
votes
0answers
16 views

Editing a Wordpress SQL table in Phpmyadmin, however its not saving

I'm trying to edit the wp_options table in Phpmyadmin, I can edit it fine using inline editing or the edit feature. Each time I log into phpmyadmin I can see the value has changed to the one I edited. ...
0
votes
1answer
78 views

Processing forms with php to wordpress database

I'm simply trying to process data from an html form into my wordpress database through php. I've tried multiple times to get the data inserted but have had no luck. The setup is as follows: Database ...
0
votes
1answer
81 views

MySQL - How to combine data from two tables into one?

So I am trying to do something a little above my knowledge base, i think. Here's what I am trying to do: I want to insert values from a form into a subscriber table ( first_name, last_name, email). ...
1
vote
0answers
90 views

inserting a post from an extern php file but post content doesn't show on wp site

I'm doing a php file that insert post's on my wordpress site. I'm filling all the fields in wp_posts, but the content doesn't shows on my wordpress site. I wonder if it's because the categories are ...
1
vote
1answer
61 views

Database: Custom table: sprintf value for DateTime column

I am creating an insert query following the insert example on the wpdb class reference. What sprintf like placeholder should be used for a DateTime column on a custom table? Allowed placeholders seem ...
1
vote
0answers
83 views

Proper usage of $wpdb->update()?

I am trying to update my custom table in Wordpress using the following php code but still no success: $tablename = "wpfeedback"; $data = array( 'mark' => $mark, 'comment' => ...
0
votes
0answers
78 views

I want to query for the 'post' and 'attachment' in wordpress using SQL query

How do I write a SQL query which will allow me to query for the 'post' and 'attachment' at the same time in MySQL? I am trying to get this information from the wordpress 'Posts' table. Please see my ...
0
votes
1answer
87 views

How to insert dash (-) into database using wpdb and new_to_publish hook?

I am saving titles of posts in a separate table for a specific use. The titles are saved to the database when a post is published. code is: add_action('future_to_publish', ...
0
votes
0answers
512 views

Insert data into mysql database with php and ajax

I made admin menu inside wordpress and I have form that allows admin to insert some values. I have html: <form id="prices_form" method="post" action=""> <div ...
0
votes
1answer
246 views

Live search from database table

I have wordpress site. I made custom table and sotred values in one row. Now I made admin menu and added input field into it. <input id="location1" type="text" /> I need to predict search ...
0
votes
2answers
29 views

get_results() query not working only when entering strings

I'm trying to send a query to a database, WHERE works fine if I'm querying for a number but not for a string. Example, if I try: $all_pages = $wpdb->get_results('SELECT post_title, guid FROM ...
0
votes
0answers
94 views

Remove Special Characters from Wordpress Media File Names in HTML

I've removed all the special characters from media filenames in the database (meta_key - _wp_attached_file - filename), I've renamed the files in the FTP and rebuilt the thumbnails a few times. ...
0
votes
0answers
22 views

Error establishing a database connection But all is same

I was upload my web file and MySQL base to CPANEL. Database name, user and password is all SAME in my config.php file. BUT i cant connect my web. /** The name of the database for WordPress */ ...
0
votes
2answers
41 views

How do I change the user via SQL?

I change a user via SQL in wordpress: SET @old_user='old_user'; SET @new_user='new_user'; UPDATE wp_users SET user_login = replace(user_login, @old_user, @new_user); UPDATE wp_users SET ...
0
votes
1answer
18 views

WP_Query with page_ids in arguments without a result

I want to get some pages with WP_Query: $resume_args = array(); $resume_args['post_type'] = 'resume'; $resume_args['posts_per_page'] = -1; //$resume_args['page_id'] = array(9046, 9346); //No ...
0
votes
0answers
31 views

Display data form externally table as posts?

I have an external MySQL table with roughly 4,000 rows and would like to display each row as a post within my Wordpress blog. The table grows almost daily so ideally I would like users to be able to ...
2
votes
1answer
52 views
17
votes
3answers
13k views

Should I use wpdb prepare?

I'm new to SQL and am wondering if I need to use wpdb->prepare for the following query to a table I've created global $wpdb; $tablename = $wpdb->prefix . "my_custom_table"; $sql = "SELECT * ...
0
votes
0answers
26 views

Add/edit row/rows in tables

I've done some tables in my wordpress-database: area, producer and product where one area contains many producers and where the producer contains many products. How to do a menuoption in the Admin ...
0
votes
1answer
455 views

Processing ajax call to php to insert into mysql database

I made top menu in wp admin dashboard. There I will have input field. It will be input where admin can enter Google locations. After picking correct location admin will press save and location will be ...
0
votes
2answers
42 views

Re-writing MySQl query for execute faster

Can any one re-write this SQL query to perform better? At present this query takes about 29 seconds to execute in BlueHost server while it takes 6 seconds in HostGator.com server. My intention is ...
1
vote
1answer
309 views

MySql Query very slow

I have a problem with a query on my website. When I load the page it is incredibly slow and only after over 12 seconds the content starts showing. I have installed a debug plugin and found the query ...
0
votes
1answer
55 views

Gaining Login Access via the Database

I have been given a job to amend a Wordpress site. I have only been given access to Cpanel. My questions are can i log in to the back end of Wordpress via Cpanel? If you can't login via Cpanel can i ...
1
vote
0answers
105 views

Manually query posts by taxonomy with MySQL

I'm trying to query posts from the WP database with the category uncategorised, while also joining the post meta table, but I can't get it to work. I get an empty result. This is my query SELECT * ...
2
votes
3answers
530 views

Search and replace text across all posts

I had used the ZD Video Plugin for WP a long time, and now, since my move to WP 3.0.2, it doesn't work anymore. To embed a YouTube video using the plugin, I would just write ...
0
votes
0answers
39 views

Export User Info into CSV - Additional Column (post_title)

I'm using the 'Export Users to CSV' a plugin for wordpress. By default, The plugin only extracts wp_users and wp_usermeta I have been wanting to add post_title column from wp_posts. I was able to ...
0
votes
1answer
340 views

Inserting Post Meta From SQL

I'm trying to get post meta to be updated/replaced with $wpdb and running into issues. I have working SQL, but cannot get it work when coding it up for my WP plugin. Extra note: The post meta being ...
0
votes
1answer
469 views

Migration problems with mysql: Operation not allowed when innodb_forced_recovery > 0 [closed]

I'm transferring a bunch of domains a new host. The site names remain the same, and for the sites I've already migrated, no manipulation was necessary in the database. It just works once name-servers ...
1
vote
1answer
13 views

My SQL function to change user_name

My wordPress database was hacked and all users_names were changed to the same thing. I'd like to write a mySql query to replace all usernames that = "x" to the user_nicename. I'm unsure how to do this ...
0
votes
1answer
80 views

How to properly send many mysql queries via php and what happens with ajax requests after they are sent?

I need to update the details of a few thousand accounts and I can't do it with pure MySQL, I need php too. With all the loops that's probably around 100k mysql queries. I chose to do it via a button ...