Add value to array in database

Your table does not have a timeofvisit column. The second value of $wpdb->insert expects column value pairs, see here. Try $wpdb->insert( $table_name, array( ‘timestamparray’ => $timeofvisit, ‘userid’ => ‘2’ ) );

live site do not update after importing sql database

I had something similar, entries of some post types didnt show. If your posts have the same IDs between dev/live environment, get the edit URL and replace the ID to see if it loads. Like : http://yoursite.com/wp-admin/post.php?post=23&action=edit Replace the ID (here ’23’) by the ID of the post/page/anythingelse you cannot see in live. If this … Read more

WordPress and SQL – Update and Insert from another table if column value doesn’t exist

Use PHP and the WordPress API. Place the following in copy-options.php and FTP it to wp-content/plugins, then activate it from the main site: <?php /** * Plugin Name: Copy Options * Plugin URI: http://wordpress.stackexchange.com/q/186092/1685 * Description: Copy options from site 2 to site 1. * Version: 0.1 * Author: TheDeadMedic * Author URI: http://wordpress.stackexchange.com/users/1685/thedeadmedic */ … Read more

#1115 – Unknown character set: ‘utf8mb4’

WordPress does not support MySQL 4 : To run WordPress your host just needs a couple of things: MySQL version 5.0 or greater (recommended: MySQL 5.5 or greater) https://wordpress.org/about/requirements/ While the utf8mb4 encoding is recent change and you might work around it, overall you still need compatible MySQL version.

Saving custom term value to the database in new table

short exmaple how i do it… (tables naming not really correct.) in this example i am trying to save _description $_POST variable. add_action ( ‘edited_term’, ‘custom_edited_term’, 10, 3); function custom_edited_term($term_id, $tt_id, $taxonomy){ if ( defined(‘DOING_AJAX’) || defined(‘DOING_CRON’) ) return; $_POST = stripslashes_deep($_POST); if (isset($_POST[‘_description’]) && trim($_POST[‘_description’]) != ”){ update_term_meta($term_id, ‘_description’, trim($_POST[‘_description’])); } else { delete_term_meta($term_id, … Read more

How to set up an auto delete post?

I will say, I don’t exactly understand your words “when a front-end sets a date”… I’m assuming wp-admin setup. Go find a post expiration plugin. There seem to be more than a couple of these out there. The plugin I’ve used ws “Post Expirator” Awesome tool. You can create a start posting and stop posting … Read more

MySQL swap one table for another?

Create a php script ( fpw-swap-thumbnails.php ) with the code below and put it in root of your site: <?php // load WordPress environment require( ‘wp-load.php’ ); $args = array( ‘posts_per_page’ => -1, ‘post_type’ => array( ‘post’, ‘page’ ), ‘post_status’ => ‘publish’ ); // get all published posts of type specified in $args $posts = … Read more

directorypress theme error mysql_error() [closed]

Thanks all, I got it I changed the code to be $SQL = “SELECT * FROM “.$wpdb->prefix.”orderdata WHERE cus_id='”.$userdata->ID.”‘ GROUP BY order_id ORDER BY autoid DESC”; $results = $wpdb->get_results($SQL); That solved the issue

Apache Redirect based on WordPress permissions

What you’re describing is likely best done in a simple WordPress plugin. You’re user roles are already stored in WordPress, so a plugin to do this is likely only a few lines long. Also an existing plugin like File Away may accomplish what your attempting. This plugin surfaced when I did a plugin search for … Read more