Split posts between databases

It is not doable if you want to keep around all wordpress features. Possible casualties of such configuration are search and RSS feeds, probably also category and author pages. If you go and actually create a new DB for each 1k posts then the game ends here as there is no simple way to share … Read more

Selecting NULL value from the database

There is no specific issue with retrieving null values from the database. They will come back as the PHP NULL value. WordPress uses either the function mysqli_fetch_object or mysql_fetch_object to retrieve results from the database. https://php.net/manual/en/function.mysql-fetch-object.php https://php.net/manual/en/mysqli-result.fetch-object.php According to those respective pages: Note: This function sets NULL fields to the PHP NULL value. Are you … Read more

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’ ) );