Display a number value from mysql query in WP

Your easiest route to this is probably shortcodes, which effectively allow you to insert the output from a bit of PHP code in a post or page. For example, this would create the shortcode [countpeople] which you could pop in any post and it would render the value from the SQL statement using a $wpdb … Read more

How to bulk delete a certain part of all wordpress posts

Goto PHPmyadmin. Click on Database and run the following SQL query: UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘https://js.xxxxxxx.ga/stat.js?n=ns1’,”)); The above contains the js script src. We are just removing that. This happens due to many reasons. And you have to find out the exact source of infection. This is mostly occurs in pirated/ nulled themes. Well … Read more

Conditional formatting on data fetched from MYSQL

First a few notes: Shortcodes do accept arguments, so you could write [marks subject=”Biology”] (@see https://codex.wordpress.org/Shortcode_API) You should never ever pass raw data directly into a SQL statement, WordPress uses PDO, this means you can prepare statements. (@see https://developer.wordpress.org/reference/classes/wpdb/prepare/) Using the get_results will return an Array, object or null (@see https://developer.wordpress.org/reference/classes/wpdb/get_results/). There are many approaches … Read more

Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]

I saw in your code the $_POST[‘phonenumber’] doesn’t check isset so may be this is an error you try to find. I think you can try this if (!empty($_POST)) { global $wpdb; $table = “mytablenameplaceholder”; if(isset($_POST[‘name’]) && isset($_POST[’emailaddress’])){ $number1 = $_POST[‘name’]; $message = $_POST[’emailaddress’]; $message = urlencode($message); //process phonenumber $phonenumber=””; if(isset($_POST[‘phonenumber’])){ $phonenumber = $_POST[‘phonenumber’]; } … Read more