How to connect to AWS RDS external database (not for the core WordPress db)

I was able to get a working connection using the following code: function test_connect_to_db() { $servername=”thedatabase.0000000000.location-1.rds.amazonaws.com”; $username=”username”; $password = ‘password’; $dbname=”database”; // Create connection $conn = new mysqli( $servername, $username, $password, $dbname ); // Check connection if ( $conn->connect_error ) { die( ‘Connection failed: ‘ . $conn->connect_error ); } $sql=”SELECT id, firstname, lastname FROM table”; … Read more

Modify MySQL Query Based on Dropdown Menu

You don’t need to write your own queries, just use wordpress functions. For instance, to get post by id; use get_post <form method=”POST”> <select name=”post_ID”> <option value=”21″>21</option> <option value=”22″>22</option> </select> <input type=”submit” value=”Get Selected Value” /> </form> <?php $post_id = $_POST[‘post_ID’]; if ( is_int( $post_id ) && !empty ($post_id ) ){ $post = get_post( $post_id … Read more

How to get data from WordPress site sql file

The problem is that your images reside in /wp-content/uploads/ and without this folder, everything will be restored except images and some files you have previously uploaded to the Media Library. The plugin(s) and the theme you used could be installed (uploaded and activated) again. To backup a WordPress websites you only need to backup the … Read more