Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Wordpress Bad Request Error 400

Can someone get me out of this trouble? I have successfuly tested wordpress on xampp and works fine, however, on a dedicated I 'm getting an error 400 Bad request until I manually remove any .php ...
0
votes
2answers
941 views

You have an error in your SQL syntax - Help with query

I have a programmer that developed a custom plug in for a client's website and after moving the site to client's server, some parts are not working. Looking at the error log, there is an issue with ...
3
votes
1answer
146 views

Does using set_transient() function can lead to MySQL problems?

As a plugin author, I have to think about many things. One of my plugins uses a temporarily PHP session to save the JSON data that receives through its API in array type. Because PHP session has its ...
1
vote
1answer
21 views

How do I see the mysql query generated by get_posts( $args )?

I'm trying to use get_posts( $args ) to get some custom post types. Is there a way to see the mysql query generated by the get_posts function?
0
votes
1answer
520 views

How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option

I'm having troubles with the mysqli driver used by wordpress, where it is converting each and every integer value to a string within $wpdb->get_results("SELECT..."). I know that it is possible so ...
0
votes
1answer
29 views

SQL: How to find all attachments that are not used in any posts/pages/custom_post_types

I have a wordpress installation where the posts also contain attachments that were not embedded in the content by using the media library -> add. I would like to find all attachments that are not ...
0
votes
0answers
17 views

SQL Joins not getting correct columns

I'm trying to alter the main query via posts_where & posts_join, in order to select the following: Orders (post-type) that have meta_key='_customer_user' that is >= 1 (can do this via standard ...
0
votes
1answer
24 views

How can I find user role in Mysql?

SELECT user_id FROM $wpdb->usermeta WHERE meta_key= .$wpdb->prefix. _capabilities AND meta_value= ROLE in serialized array. How can I set meta_value in serialized array? Many thanks in advance ...
0
votes
1answer
34 views

How to display MySQL table data which is stored as an array?

I have the table "mlw_results" which stores results of quizzes on my WordPress website. I use "Quiz And Survey Master" plugin to create these quizzes. Now I need to display all the results of a ...
0
votes
0answers
39 views

Wordpress UPDATE queries on MySQL database stuck

I have an Amazon 24XL server 96 Cores 378 GB RAM Database size 5.7G Debian GNU/Linux 9 (stretch) PHP 7.3.16 mysql Ver 15.1 Distrib 10.3.22-MariaDB I have only one WordPress site where users read ...
0
votes
0answers
17 views

Store GA Client ID in User DB

How can I retrieve Google Analytics Client ID from HTTP headers and store in a custom field in the User database table?
0
votes
1answer
591 views

WordPress database error Duplicate entry for key 'slug'

I have just migrated to a new host and upgraded my Wordpress to 4.9.8 (from 3.9.x, embarrassing I know, plan to keep it up to date from now on). I also went through the process of replacing plugins ...
0
votes
1answer
648 views

The function is deprecated; use mysql_real_escape_string() instead

I don`t know coding. I recently my website stop to work properly. I get this error on the top of on every page loaded. Deprecated: mysql_escape_string(): This function is deprecated; use ...
0
votes
1answer
513 views

Create a new table on the database and save parameters from a contact form

I have a wordpress function in functions.php which gets parameters from a form I made and gets parameters like IP addresses and UTM tags (from the URL) and sends them to me by email. I want to get ...
0
votes
1answer
517 views

mySQL database size large, but tables size less

I have my site hosted with NetworkSolution, and they have a sql database size limit of 300MB. IF the size exceeds this limit we cannot access the wordpress admin dashboard. So currently its showing ...
1
vote
0answers
21 views

Woocommerce PHP site that shows table with orders from specific category

i want to make a PHP site for each of my deliverer that shows orders for them, im using querry like this to show orders: select p.ID as order_id, p.post_date, max( CASE WHEN pm.meta_key =...
1
vote
2answers
562 views

Mysql SELECT posts

how i can get posts via MYSQL from posts where language is 'en' and 'ru' I have this query $sql = "SELECT p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1 ON ( wm1.post_id = p1....
1
vote
3answers
1k views

How to execute mulitple statement SQL queries using $wpdb->query?

I call $wpdb->query() on a query like INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 0); INSERT INTO wp_ctt_timetables (name, homework, tod, ...
0
votes
1answer
599 views

Pull MySQL data from multiple tables and merge into 1 PHP array

Appreciate help in advance. I am dealing with a bit of a pickle with a formula. I am trying to create a page template that will display a list of users, specific metadata from usermeta table + ...
1
vote
0answers
9 views

WpDataTables - View Image Directory

I made a form in PHP and it has an image upload that returns the image name in MySQL, and in the Wp-admin / wordpress folder. It is functional, so I created a column with URL Link in DataTables to ...
0
votes
1answer
23 views

Store GravityForm data in phpmyadmin (mysql)

I'm currently developing a small portal on Wordpress for a client where users have to submit forms (created with Gravity Forms). I'd like to be able to store the data from these forms, upon submission,...
1
vote
1answer
20 views

Better ads plugin has 500.000 entries in wp_postmeta

My wp_postmeta table is huge, around 1.2 million entries, about half of those are caused by bs entries (_bs_via_rel_2, _bs_review_verdict, _bs_source_url_2, _bs_source_url_3... etc). From what little ...
0
votes
1answer
13 views

Find locations of all featured images of draft posts via SQL

I'm trying to get the file locations of all featured images used in draft type posts via SQL and phpmyadmin. posts type attachment should hold the location of the image in the guid column. SELECT ...
0
votes
1answer
595 views

Merging development site with live site

Earlier this year I built a client a large website for their organization. After that site was finished and live on the web (not on our development server anymore) they wanted the company I work for ...
1
vote
1answer
2k views

How to insert data into MySQL database from the form created in WordPress site

How can I insert the data entered into the form in WordPress site to the MySQL database? I have created a form in the site. I am able to run PHP codes using snippets but I don't know how to update the ...
13
votes
10answers
26k 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 ...
1
vote
1answer
527 views

Hacked Wordpress website /Homepage redirect

I am very sorry about the length of the post, please bear with me as I am going to try and list everything I've done so far. I am dealing with a hacked WordPress site which had been left without ...
1
vote
1answer
558 views

PHP script can't connect to Database on port 3307

I can connect to mysql just fine with my port number through the command line like so: mysql -h ##.##.##.## -P 3307 -u wpuser -p I have a php file that tries to connect to the DB, <?php ...
1
vote
1answer
611 views

How to securely provide a $_POST var in WP_Query with PHP 7?

In PHP 5.5 you had the function mysql_real_escape_string() and I always did htmlspecialchars(mysql_real_escape_string($_POST['...])); to secure against SQL-Injection. With PHP 7 ...
1
vote
2answers
2k views

Modern Tribe Calendar wp-query with meta query not working at all

I've been searching for a good few days now trying to get my WordPress event calendar by modern tribe working as I need it to. I have hundreds of order by and delivery dates in DB each one separated ...
0
votes
1answer
530 views

Insert double entry in DB

I created plugin and my plugin create new Table in DB. My problem is when user type something in field firstname, lastname... and click on button Submit, that go to my table and that is ok.. but then ...
0
votes
1answer
18 views

Same request Mysql/Php not same result

I have this PHP query: $querystrShop = $wpdb->get_results(" SELECT productid AS post_id,( 3959 * acos(cos(radians($latitude)) * cos( radians(...
0
votes
0answers
22 views

Insert and retreive data from custom database from Wordpress page

This is the first question I'm asking here, so I'm open to any feedback on how to clarify my problem/question! I have created a small javascript game on a wordpress page with "custom html". I'd like ...
0
votes
0answers
8 views

My WordPress website loads with all content highlighted

everyone. I'm having an issue that randomly started recently where all content is being highlighted when the page loads. This is actually the first time I've come across such an issue. Has anyone ...
1
vote
2answers
844 views

$wpdb select all meta for each post

I'm running the following query trying to get the data and associated meta data of a huge number of posts: SELECT wp_posts.post_title, wp_posts.post_date, wp_posts.ID, wp_postmeta.post_id, ...
0
votes
1answer
571 views

Plugin MySQL SELECT custom data and filter on user meta

I'm porting a custom PHP feature to be part of a Wordpress plugin. At present, my USERS table has a field (let's call it FLAG) which my MySQL query needs to filter on, eg: SELECT custom-data FROM ...
0
votes
1answer
477 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 ...
1
vote
1answer
632 views

UPDATE on SELECT results. A SQL query to swap Author with Meta Box value

I inherited a project where, for some reason, the previous developer make a custom post type for authors and a custom select listing all those authors cpt titles in the post edit screen. This led to a ...
0
votes
0answers
28 views

Got 404 error when changed siteurl via DB in Wordpress

The problem is that I have changed the wp_options table with site URL and home fields from http://localhost/WordPress to http://localhost/test I get 404 errors or Object not found error. What I ...
0
votes
1answer
711 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
33 views

SQL syntax error. However, it works normally at phpmyadmin

I have this error : [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 4] SELECT COUNT(*) FROM ...
0
votes
1answer
21 views

Get decimal from product price with Mysql

I try to get min product price like this: $pts = $wpdb->get_results("SELECT post_title, ID, MIN( CAST(wm.meta_value AS UNSIGNED)) AS price FROM phiz_posts INNER JOIN phiz_postmeta wm ON (...
3
votes
3answers
2k views

My WordPress site always displays a cached version of its homepage

First of all, sorry if I'm making a mistake. I already asked this on the ServerFault forum, but got no answers at the moment and I thought it would be a good idea to ask the question here, considering ...
1
vote
1answer
525 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 ...
1
vote
2answers
253 views

Weird 404 URL Problem - domain name being placed at end of urls

For some reason when doing crawl tests I'm finding pages with the domain name being tacked on the end and causing 404 errors. For example: http://domainname.com/page-name/http://domainname.com This ...
0
votes
1answer
39 views

Is deleting orphaned wp_options entries safe?

I have a wordpress site with some serious wp_options table bloating. This is causing slow page loads and memory bloat. After investigation, there appears to be thousands of orphaned entries. Is the ...
0
votes
2answers
1k views

$wpdb->get_var not returning count

I'm trying to do a count for pagination and its returning NULL why the query returns results correctly. In this case $total returns NULL which is not correct why? (I didn't include the $args as they ...
0
votes
0answers
22 views

Limit total number of post and post per page with get_results

I'm using a custom table with a additional column, so I can't use regular wp_query. My code is working great except for the total number of post. I want to display 5 results per page (which works ...
0
votes
0answers
24 views

Recounting all posts' comments

I moved back from Disqus to WordPress' built-in comment system. Unfortunately many of my posts display the wrong number of comments (many say 0 comments but that's wrong). This code works for PHP up ...
2
votes
3answers
3k views

Removing the first image in content

I've been using this code: function remove_first_image ($content) { if (!is_page() && !is_feed() && !is_feed()) { $content = preg_replace("/<img[^>]+\>/i", "", $content, 1); }...

1 2
3
4 5
28