How can I rebuild my websites while I don’t have databases?

Your database contains all your data for each of your sites. Without the databases, your sites will not have any posts, pages, site configuration, users, comments, or settings. If you stand these back up, you will have to create blank databases for each and install WordPress from scratch. You can follow the “Famous 5-minute Installation” … Read more

wpdb prepare without placeholder

Short answer: You should use the way described in the documentation, sanitize anything that goes in an SQL query, and always use prepared statements. Slightly longer answer: The main use of $wpdb->prepare() is to prevent against SQL injection attacks. Here, we don’t know where ‘foo’, 1337 and ‘%bar’ come from. And that’s somewhat the deciding … Read more

Tool to check the database in Production [closed]

You can try use: MySQL WorkBench or other MySQL Client program; SSH to the Server and connect from the command prompt; Use PHPMyAdmin (make sure to password protect and set the right configuration); If you are really in need of an extra level of security you may want to consider setting up a VPN between … Read more

Best db table structure for users with many records

Personaly I would go with one table for all users. Having more tables with the same columns seems like a strange idea to me. The database will be a complete mess after you gwt more users. Make sure that the user_id is an index for the table and all your select/update/delete will be fine. The … Read more

How to delete field using WPDB?

You can’t “delete” a field in MySQL, this only works for complete rows. However, you can unset values, meaning setting them to their original state, usually NULL or an empty string. $wpdb->update($wpdb->posts, array( ‘product_rank’ => NULL ), array( ‘ID’ => $post_id ));

How do I use update_option to give me a new option name each time a form is submitted? [duplicate]

To update a new option name each time you need something unique to be used as option name so may be using ‘time’ in the option name $now = new DateTime(); $mytime = $now->format(‘Y-m-d H:i:s’); // MySQL datetime format // $now->getTimestamp(); // Unix Timestamp $option[‘prefix-‘.$mytime] = ‘your value’; Then you can update as you wish. … Read more