Having all “non-PHP” files on a different server

A couple of things: there are robust CDN plugins that you should use instead of trying to do this manually. That’ll handle performance if that’s the motivation for separating php from other files. If your concern is just that you like to separate them in your source because of personal aesthetic code organization reasons, you … Read more

Best way to store 1 billion+ posts?

I don’t know about how long it will take to create that many tables, especially if you do it in one go, but you can use $wpdb to handle the creation. There’s an article on the Codex regarding creating custom tables, https://codex.wordpress.org/Creating_Tables_with_Plugins And it crossed my mind that perhaps using some external tool to handle … Read more

how to SELECT meta values that are not null?

I founded myself my searching: $sql = $wpdb->prepare( ” SELECT meta_value FROM {$wpdb->prefix}commentmeta INNER JOIN {$wpdb->prefix}comments ON {$wpdb->prefix}commentmeta.comment_id = {$wpdb->prefix}comments.comment_ID WHERE comment_post_ID = %d AND meta_key = ‘rating’ AND meta_value IS NOT NULL AND meta_value <> ” “, get_the_ID() ); $results = $wpdb->get_results( $sql );

Troubles when I want to connect to another DB

Use code as below : <?php $myotherdatabase = new wpdb(“username”,”password”,”databasename”,”localhost”); $motscles = “abri”; $query = “SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key` = ‘nom’ AND MATCH (`meta_value`) AGAINST (‘” . $motscles . “‘ IN BOOLEAN MODE)”; $result = $myotherdatabase -> get_results($query, ARRAY_A); foreach ($result as $post) { $pids .= $post->post_id . “,”;// ARRAY_A } echo $pids; … Read more

Getting values from form and saving in database but spaces are inserted instead of form values

<?php /* Template Name: Dummy Practice Page*/?> <div id=”main-content” class=”main-content”> <div class=”main-content-inner”> <form method=”post”> <p><div> <input name=”nametxt” id=”nametxt” type=”text” style=”height:30px; width: 350px; ” maxlength=”5″ placeholder=”Name” required><br> </p></div> <p><div> <input name=”designationtxt” id=”designationtxt” type=”text” style=”height:30px; width: 350px; ” maxlength=”50″ placeholder=”Designation” required><br> </p></div> <p><div> <input name=”descriptiontxt” id=”descriptiontxt” type=”text” style=”height:30px; width: 350px; ” maxlength=”1000″ placeholder=”Description” required><br> </p></div> <input id=”submitbtn” … Read more