Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
675 views

Checking for new message using AJAX and PHP. Server overload?

I wrote a script (it may not be perfect, I'm newbie) to check for new message (using ArrowChat and Buddypress) every X mins. It works good, but I'm worried will it overload my server? It's shared. ...
0
votes
1answer
518 views

How can I export posts with featured images, without download them

Exporting posts with featured images without downloading them. I work with a site that has 10000 media in a blob and nothing is allocated in the uploads folder. How do I export the posts without ...
0
votes
1answer
23 views

How can i syn wordpress user table with a stand-alone php script?

I have a wordpress membership site running with users already signed up. I currently installed a new php script on the same mysql database which will require existing user to signup. I would like the ...
0
votes
2answers
391 views

Bulk append URL (add word to slug)

Is there a way to bulk add one word at the end of each URL for posts? I have around 3500 posts and it would be time consuming to add to each one. For example URL's are www.example.com/my-post/ www....
0
votes
0answers
476 views

Query doesn't display text data with apostrophes

I've got this code: if (is_user_logged_in()) { $user = wp_get_current_user(); $tenantsInfo = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM exp_ten WHERE tenant_number = %d ", $user->...
0
votes
1answer
13 views

(Who to follow) Twitter widget

Hello I have a social network site and I want to make (Who to follow) widget like Twitter, each user I have on my site have two custom meta: following_users (users that I follow) followers_users (...
0
votes
2answers
59 views

Moved site, Old links in pages still pointing to old host

I am sure someone has answered this but I have not found a definitive answer. I have a site that I moved from one site with an old domain to a new host with an new domain. I changed the site URL in ...
0
votes
1answer
1k views

How do I transfer user passwords from one WordPress site to another?

Let me begin by saying I know this is generally advised against but I'm in a tough spot at work where this is essentially being demanded and to my understanding it's theoretically possible. I am ...
1
vote
1answer
1k views

How to get last updated row or ID in wordpress

How to get last updated row or ID in wordpress. Like : $wpdb->insert_id;
0
votes
2answers
399 views

mysql query - how to escape apostrophe?

I've got this query: $tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID); I use some echo to show data on frontend: if ($tenantsInfo) { ...
0
votes
1answer
46 views

How does WP work in conjunction with a web server?

I have background in programming (I am an electrical engineer and have become familiar with numerous languages over the years); however, I only starting working with wordpress and backend web ...
1
vote
1answer
384 views

Slow Mysql Queries

I'm having issues with Wordpress being too slow. I discovered it's because of MySQL queries. They take sometimes 2 - 10s - way too long. I installed Query Monitor to see what's causing the problem: ...
1
vote
1answer
75 views

Which is more efficient? Using usermeta, or creating a new MySQL table?

I'm building a bookmarking feature, allowing users to place a marker inside a blog post. The data will then be saved in the database, and retrieved upon opening that blog post. The same concept can ...
0
votes
1answer
1k views

Submitting a form, using Ajax, to run a SQL Select query based on user input from the form

I'm creating a web form on my WordPress-powered website, such that by entering a date and some upper/lower bounds into the provided fields, then submitting the form, the page will query a MySQL table, ...
0
votes
0answers
260 views

An SQL query to find orphaned image attachments and their meta

This is for people who are good with MySQL queries. I'm using phpMyAdmin locally to try to optimize an old WordPress & Woocommerce site which has gone through a couple of iterations over the years....
0
votes
0answers
133 views

Multiple wpostmeta.meta_key

i need to add a new condition to this query: $querystr = " SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id IN( SELECT DISTINCT wpostmeta.post_id ...
0
votes
1answer
108 views

External wpdb connections in different plugins on single page

I am writing plugins that connects to an external database, connecting to the external database using the wpdb class: $mydb = new wpdb('username','password','database','localhost'); $rows = $mydb->...
0
votes
1answer
1k views

insert data from a form:: Warning Empty query mysqli::query()

I'm unfortunately getting an empty query warning and i cant seem to find the issue I hope you'll help me. mysqli->query( ) --> $result = $conn->query($sql); is where it tells me i'm doing something ...
0
votes
1answer
22 views

I want show only data for today

I am trying to fetch data according to current date. data only show on current date $user1 = $wpdb->get_results("select product,checked_by,submit_date,suppliers,comments,van_temperature from ...
1
vote
0answers
152 views

Long running queries

I'm trying to build a PHP script that will pull the 10 most read posts (weekly) and will return me an XML file (so I can link it to Mailchimp). Im also using - Post Views Stats Wordpress plugin by ...
2
votes
0answers
406 views

Performance issues with large website [closed]

I've been struggling with this website for a while now so any kind of help is deeply appreciated. Server configurations The website is running on a dedicated server from hostgator with the following ...
0
votes
1answer
65 views

How can I get $wpdb to show MySQL warnings?

In some cases, when given a bad query, will attempt to run the query, and give a warning (instead of an error). In the MySQL prompt, to see these warnings, you can run SHOW WARNINGS;. For instance: ...
0
votes
2answers
187 views

Meta Query doesn't works as espected

i have a little big problem with meta queries. I Designed a query to retrieve posts where any of these words exists in the custom field pickup_address. the field has this string in its meta value: 43 ...
-1
votes
1answer
85 views

I am unable to fetch json data from wp_db

I am trying to fetch data from wp_table.But query is show blank.If I am trying to get integer value then output is come .Like if I am try to fetch data integer type like user_id then query show ...
0
votes
1answer
181 views

multiple where condition in result query

I am trying to get data with multiple where condition but i do not where is problem .this query sending blank out put.any help. $user1 = $wpdb->get_results("select product,checked_by,submit_date,...
-1
votes
2answers
420 views

Execute multiple PHP Snippets causes error?

I want to execute multiple different PHP snippets which all retrives 1 page ID (yes, I want to extend the code and display some other things then the page ID). But if I execute 2 or more snippets at ...
-1
votes
1answer
835 views

Update WooCommerce Short Description using SQL

How can I update my wordpress database with a SQL query to move the [Description] field into the [Short description] and then set the [Description] blank ?
0
votes
0answers
595 views

Rewrite SQL query as a prepared statement and use in foreach loop

I have a sql query that I use to populate a table with data. It looks like this <?php $client = $wpdb->get_results("SELECT concat (string, string2), type FROM `file` WHERE `code` = ...
0
votes
1answer
274 views

Wordpress delete mysql rows with string

So I'm updating the code of an old wordpress plugin(never released), and I want the database to be "clean" before importing new data otherwise data will just add up and i want it clean before every ...
0
votes
1answer
124 views

How to do a MySql query in WordPress?

I want to get the last auto-incremented ID's value of a particular table. I found a MySql function on the internet to do that. But I'm not sure how can I use this function in WordPress to get the ...
0
votes
1answer
24 views

Changing between Local Host DB to Production DB and in reverse

How can I manage that when I switching from Production to Local Host and in reverse all the changes will apply? How do I import changes from, when the site was live to when I switch it to the ...
1
vote
2answers
41 views

Switching Databases in LocalHost

3 weeks ago I uploaded all my files from localhost to cPanel. I want to switch it back , the issue I facing is my original database from the localhost is not updated . I downloaded the database from ...
0
votes
1answer
35 views

Some Post Content Does Not Show Up In DB Search

I am using MySQL Workbench to search for URL's in my DB, in order to use sql's update() to change them to a different URL. Easy enough. What bugs me is even then, some of these URL's, nearly all of ...
0
votes
1answer
21 views

mysql query order by

I'm new to mysql. I've got this query: $tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID); I need to order it by desc; Due to double-quotes I'...
0
votes
2answers
35 views

After I migrated a website for WordPress - Saved changes in wordpress settings >> permalinks. Homepage only working, links not working

I saw this question on another post but was unable to add an answer because my reputation is too low. So I thought I would create a new thread. So I migrated a website from a draft server to a live ...
0
votes
1answer
143 views

simple wordpress ajax plugin not working when not logged in

anyone encountered this bug that it will work when you are logged in but once you log out it won't work anymore. this is a very simple plugin that will fetch zip code and display the corresponding ...
0
votes
0answers
41 views

Prepared DB Query from _POST array

hey guys i'm somewhat a beginner in wordpress, and wrote my own theme now Question: what is the proper way of doing a sql query to a custom mysql table in combination with POST Data. The problem ...
0
votes
1answer
201 views

get/show Last ID

When our users submit a form (Contact 7), I want to get the next available Auto-Increment number (order-post-ID) and insert this into one of the fields. This is sent along with the form in order to ...
-3
votes
3answers
391 views

Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel

I deleted everything in my directory to "start over" When I install wordpress it says : Your PHP installation appears to be missing the MySQL extension which is required by WordPress. I tried changing ...
0
votes
1answer
225 views

Database hacked - random posts are modified

I have noticed that part of my posts was modified. Sometimes the original post is mixed with random words consist with random characters or content is replaced by spam. I have a lot of posts and I am ...
0
votes
1answer
55 views

creating new field on mysql

I would like to add extra sections like "gender" on the WordPress user database. I would like to draw information from this information later. For example, let's say I want to attract gender. I ...
0
votes
0answers
1k views

Combine tax_query and meta_query in WP_Query

I'm building a search in WordPress. I look for a custom_post_type in combination with several custom taxonomys and metadatas. custom_post_type: vehicle taxonomys: brand, fueltype, ... metadata: ...
1
vote
0answers
22 views

how to access all user dashboard on fronted page [closed]

i am new for WordPress and i am creating a membership web site. i have my requirement access user dashboard on fronted page like same to same backed user dashboard. with all activity like change user ...
1
vote
0answers
122 views

Insert data from .sql file in wordpress plugin

I'm creating a wordpress plugin that need to create a table and insert location data to that. There are more than 50000 locations in that INSERT query, so that in separate .sql file. I need to run ...
0
votes
1answer
69 views

Bulk Change Wordpress category Slug

Am trying to bulk add "subbed" at the end of 5k category terms. I tried running this in sql. update wpkf_terms set cat_name = CONCAT(cat_name, '-subbed') But I got this error Error SQL query: ...
0
votes
1answer
151 views

Advanced Wordpress SQL Query

after 4 hours I am not able to find solution, how to correctly write the SQL query to echo data from two tables. I have two tables and I need to "JOIN" theirs data. First table is wp_users and the ...
0
votes
1answer
251 views

Query the Wordpress database to get data together with replaced information

sorry for cross-posting: I posted a similar question on StackOverflow but I received no attention (my fault, for sure). I need to query a Wordpress database. The first table is wp_posts: from this ...
1
vote
1answer
462 views

MySQL variable in query

I've got tenant portal when I need to show running balance for each transaction. Here's query I've written which does what I need it to do. Problem I've got is that it doesn't work in Wordpress. Here'...
0
votes
1answer
110 views

Filter on the day of the week from timestamp

I'm trying to filter the display of posts by the day of the week (1=Mon, 2=Tues, etc) in the admin edit area. The custom field 'some-date' is a timestamp. The code below is not the right approach to ...
4
votes
1answer
1k views

Creating 20,000 Posts or Pages using a .csv file?

Here's my challenge: I have a .csv file which contains 20,000 rows of data. Each row contains 5 columns of data on an particular individual. I need each row (each person) to be populated into a ...