Display Results of SQL Query on WP site

I see the error described above. I am assuming I need to do a foreach or while command – but all attempts to use these have not yielded results. Yes, shortcodes return strings, not arrays/lists. You need to convert your array/list into a single string. However, get_var assumes a single result. If you want multiple … Read more

How to escape percentage sign(%) in sql query with $wpdb->prepare?

This is an incorrect use of prepare, that function is used to safely insert variables into queries. However the code in your question does this beforehand, bypassing the security function. E.g. What you did: $unsafesql = “INSERT $dangerousvariable”; $still_unsafe_sql = $wpdb->prepare( $sql, ” ); What it should be: $safe_sql = $wpdb->prepare( “INSERT %s”, $dangerousvariable );