Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
1k views

Custom DB_COLLATE (collation) value not working on fresh install?

I always knew that WordPress uses utf8_general_ci as tables collation, but recently it keeps installing utf8mb4_unicode_520_ci. What I do is: Download WordPress from wordpress.org Rename wp-config-...
0
votes
0answers
19 views

Improve performance by removing unnecessary database queries

I've just found out that main page of custom theme im developing does 150 db queries on every load (what takes even 2.5 seconds). Many of them come from functions.php, and are caused by for example ...
1
vote
2answers
3k 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
1answer
596 views

How to change the publishing date of each posts?

I need to set the publishing date of many posts with the post date (the creation date). I know that I can do it editing the single post and changing the Published on value but this procedure is ...
1
vote
2answers
1k views

Problems migrating WordPress to localhost

I have just followed this guide on manually migrating a WordPress site to localhost. I have followed all of the steps: downloading files using FTP, exporting database, importing to localhost database,...
0
votes
1answer
580 views

$wpdb->prepare is not working like mysql_real_escape_string

I'm working on a WordPress plugin and recently I have planned to migrate from SQL to $wpdb. I'm using a method called $wpdb->prepare instead of mysql_real_escape_string but it does not work. Here ...
1
vote
1answer
807 views

Separate DB by yearly archive of Wordpress

I have large DB of blog post I already export it by year and wanted to make archive by year doing it on subdomain, like 2012.mysite.com I stack looking for solution on internet, I wondering if their ...
0
votes
0answers
11 views

like statement for <?php $current_user->user_login ?>

I have a mysql query the gets data based on the user_login. We've recently upgraged to allow multiple users from a company to access the site. The main login is 5 characters and additional users ...
3
votes
1answer
3k views

Error: MySQL shutdown unexpectedly. XAMPP local conf running WordPress

I have a xampp configurated locally to run wordpress. I must have done something wrong when fixing some issues 'cuz at the end, I got stuck with the following log from mysql database. 2015-11-10 15:...
0
votes
0answers
20 views

I wanted to Know that how can I give ingore to 0000-00-00 in my config file

I wanted to know that how can I give ignore to 0000-00-00 in my config file so that I didn't get an error of invalid value for this Zero-Date 0000-00-00 in my site database.
0
votes
2answers
19 views

What is my error trying to create a new table in the database?

I tried creating the tables in different ways and I always get the same error: "Error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ...
0
votes
2answers
667 views

how to check for wordpress Query errors

In mysql or mysqli you can add this type of Query: <?php $sql = mysqli_query($con, Insert into database itt (name) VALUES ($name)") or die(mysqli_error($con)); ?> What does wordpress do ...
0
votes
1answer
2k 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 ...
1
vote
0answers
21 views

Wordpress Query is taking more then 20 second and stuck on creating index

Hi I need help with below query this query takes around 20 second and when more then one is executed then server CPU usage hits 100% and server stop responding. here is the query from process list. ...
0
votes
2answers
1k views

live site do not update after importing sql database

My live website is not updating after importing sql database from wamp local server until last time all went perfect but last night I was not able to see the changes live made in local. what I did: -...
0
votes
1answer
644 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
22 views

I imported an restore an database and It shows #1067 - Invalid default value for 'user_registered'

My database tables become corrupted so for fixing them I restored data and It shows an error #1067 - Invalid default value for 'user_registered' how can I fix it.
0
votes
1answer
803 views

Populate custom post type/custom fields from an external database

I have a custom MySQL DB(same host/different domain) with a lot of vehicle information. What we want to do is populate a custom post type and custom fields with this data so that it's SEO friendly in ...
3
votes
3answers
11k views

What causes the “max_user_connections” warning on WordPress frontend?

I'm currently getting this error in the front-end only (not inside /wp-admin): Warning: mysqli_real_connect(): (HY000/1203): User xxx already has more than 'max_user_connections' active connections in ...
0
votes
0answers
22 views

SQL to join u3g_users & u3g_meta_value with repeating data

I'm using the below SQL to create a table from wordpress user information joining data in u3g_users and u3g_metavalue. SELECT u3g_users.`ID`, u3g_users.`display_name` AS `Name`, ...
0
votes
1answer
18 views

Set a cron job to delete a specific database table table every midnight

my name is frank, i have been trying to create a cronjob that will be deleting a database table every 12 midnight but i found no help, below is the database table. please any help? DELETE FROM ...
3
votes
4answers
1k 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 [zdvideo]url-of-youtube-...
1
vote
1answer
1k 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
729 views

WordPress and SQL - Update and Insert from another table if column value doesn't exist

Stuck with some mysql for my wordpress site. All within 1 DB. I am attempting to update wp_options table from wp_2_options (Multisite). They both have option_name (unique_key) and option_value ...
1
vote
0answers
576 views

WordPress php mysql errors - errcode: 13 permission denied

I'm developing a WordPress based website using the latest XAMPP release from Oct 9 2019 with Apache 2.4.41, MySQL/MariaDB 10.4.8 and php 7.3.10 using localhost on a Windows 10 machine. Since updating ...
1
vote
1answer
971 views

Replacing mysql_escape_string in a custom plugin when moving to PHP7

I have a custom developed plugin for a wordpress website that is an online car community on php5.6. I didn't develop the site originally but am now the custodian. I have limited programming ...
1
vote
3answers
336 views

$wpdb -> Batch insert from XML File?

Actually im stuck on this! XML-File ~ 140.000 Rows Filesize ~ 9.0 MB LOAD XML INFILE 'file_name' isnt't allowed ( shared hosting! ) The supplier provides a single XML file with quantity and sku. The ...
0
votes
1answer
13 views

How to edit custom table data in frontend

I am trying to edit the data from the table in the frontend. when I click the edit the form doesn't anything it show only empty field Html Code <form action="" id="postjob" ...
0
votes
1answer
642 views

Missing latest posts and options after DB migration via phpMyAdmin

The latest posts and options are not appearing after importing the database. I'm missing all the latest posts and the latest Advanced Custom Fields. The export is from the remote server and import to ...
0
votes
0answers
12 views

How to dynamically generate forms from a template, based on user input in the admin area?

I write to the community with the hope that someones can show me the correct way to solve my issue. I'm trying to create a simple plugin that should generate multiple contact forms from a Form ...
3
votes
3answers
2k views

Programmatically changing role information; editing role name and deleting

I am making system where I am delegating a lot of functionality to the front end of a system using Wordpress. I have listed all the roles (most of the custom) and need to ability for a logged in user ...
0
votes
0answers
27 views

Wordpress Ajax Custom Query - High CPU LOAD

I'm developing a fully ajax community WP theme that comes with alot of custom quaries. Everything is fine, there is no bug but recently but I had a few client that have a huge database and my theme ...
0
votes
0answers
9 views

WordPress database(MySQL) sync with the MSSQL database

I have WordPress website and database(MySQL), I want to sync WordPress database to my other portal database(In MS SQL), is it possible to do it? Please guide me.
0
votes
2answers
632 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
24 views

PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2

Recently I updated my websites php from 5.6 to 7.2 but afterwards my website sometimes/often shows the internal server error message. I set debug to true and got the following errors: PHP Warning: ...
1
vote
1answer
836 views

Wp query show post by author name or post title or post content

I have to create a search query which allows me to filter all posts where author name and post titles or post content has the word from search textbox. So if i search wordpress it should list all the ...
0
votes
3answers
825 views

Displaying data from custom table

Just looking for a bit of advice on how to handle this: In the past (many moons ago) when I did the occasional php/mysql work, it was relatively easy to pull/display data from a table using the table ...
0
votes
3answers
841 views

How to bulk delete a certain part of all wordpress posts

site been hacked, and all posts been injected a line of js code under the content! <script src='https://js.xxxxxxx.ga/stat.js?n=ns1' type='text/javascript'></script> I have found the ...
0
votes
1answer
848 views

Custom redirects with using SQL

We have pages with urls like this: http://example.com/?page_id=3&user_id=5 http://example.com/?page_id=6&user_id=9 etc. page_id and user_id located in table MySQL Database. And this table has the ...
2
votes
2answers
481 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 ...
1
vote
2answers
1k views

How to import a custom MySQL DB table into a WordPress custom post type

What I've done so far is create a plugin that creates a custom post type, takes a field(ID from the custom DB) and also creates a couple of page templates. I have a custom MySQL DB that is on the ...
0
votes
1answer
716 views

How to set up an auto delete post?

I want to create a form in which when a front-end sets a date and on that date the post gets automatically deleted. Is it possible?
0
votes
1answer
19 views

Always get <errno: 150 “Foreign key constraint is incorrectly formed”> creating a new table with foreign key

I create a table in WordPress database with this SQL query: CREATE TABLE IF NOT EXISTS wp_ccwwhsh_sent_messages( `id` INT NOT NULL AUTO_INCREMENT, `timestamp` DATETIME NOT NULL DEFAULT ...
0
votes
0answers
19 views

Change woocommerce order status by database change

I have a dropshipping client who uses Delphi in his company. He connected his system to my wordpress database and can read and write it. The WordPress site runs on a windows server. How can I make ...
0
votes
0answers
18 views

MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?

Usingthe following shortcode function, I have the code building a table by querying the DB. That all works fine. BUT when I add any type of formatting to the TimeStamp column such as DATE_FORMAT or ...
0
votes
2answers
1k views

How to pass username into form that sends data to database

I am trying to pass username to database through form: [insert_php] $current_user= wp_get_current_user(); $id= $current_user->user_login; [/insert_php] <input type="hidden" name="id" value="[...
0
votes
1answer
23 views

Inside Array - “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]

I know that there is a very old answer that details unidentified index but using the methods there I can not figure out how to make isset work with the code I have. It is below but doesnt solve the ...
0
votes
0answers
24 views

Usermeta data unserialize, extract and display in table in Wordpress

I would like to know how to extract data from Wordpress, unserialize and show it in a table. Below is my starting point. The columns address, group and divider all have serialize data in. I have ...
0
votes
1answer
2k views

How to add a custom field and incrementing value for all the published posts

I'm trying to add a custom field value "article" and auto - increment value starting from 1 for all the published and new post starting from the first post. I'm trying with the below code in Mysql. ...
1
vote
1answer
611 views

Uncaught Error: Call to undefined function mysql_connect() - Wordpress installation

Trying to install wordpress without xamp on my local machine. Version info: Wordpress: 5.2.3 PHP: 7.3.9 Apache: 2.4.41 When accessing this url -http://localhost:8080/wordpress/wp-admin/install.php, ...

1
2 3 4 5
29