How do I display SQL query on a specific page of my wordpress site

$result = $wpdb->get_results( “SELECT `account_number`,`consumer_name`,`bill_amount`,`due_date`,`disco_date`,`bill_status` FROM {$wpdb->prefix}_bill_inquiry where `account_number` = ‘$inputnumber’ AND `pin_number` = ‘$inputpin'”, OBJECT ); $wpdb->prefix will automatically print the prefix, then to convert the result in array form you can use the following snippet: $result = json_decode(json_encode($result),true); You can either place it in a template or you can create a shortcode in … Read more

How to Add or Change Post Title

The first thing you want to do will be find the post you want to modify. To find the post named “beddu” which post_type is post, you can excute this query: SELECT * FROM wp_posts WHERE post_type=”post” AND post_title=”beddu”; After you test and find the condition is correct. Move to update part. UPDATE wp_posts SET … Read more

Fastest way to display 5000 post titles?

In my opinion and from what i’ve seen on testing. Using any WordPress function will slow things down dramatically. The fastest way i found to do this is by querying MySQL directly and grabbing only the things needed. For example: $products = $wpdb->get_results( “SELECT post_title, post_name FROM `wp_posts` WHERE post_type=”products””, ARRAY_A ); echo ‘<ol>’; foreach … 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 );

What steps do I need to take to install a local copy of a live website?

wp-cli makes use of your wp-config.php credentials to connect to the db, so the fact that you are getting the install screen, and not getting any errors (I assume) when running wp-cli commands says that you seem to have it configured correctly. My only thought would be that your $table_prefix value doesn’t match the tables … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)