Need to supply variable to an sql statement.
-
Hi,
I have been battling this for hours and canot find the solution
I need to return some text from a plugins table using the following php
<?php $post_id = get_the_ID(); echo $wpdb->get_var( $wpdb->prepare(“SELECT message_before FROM {$wpdb->prefix}mlw_quizzes WHERE quiz_id = %d”, $post_id ) ); ?>
I know the variable works as
<?php echo $post_id= get_the_ID(); ?>
works
I’ve resused similar code and just cannot get it to work.
Any help appreciated.
-
Hi @akky66,
It sounds like you’re using the WordPress open-source software and are hosting on another site, (WordPress.org).
You can learn about the differences here:
https://wordpress.com/support/com-vs-org/You don’t have the ability to edit php on WordPress.com sites.
I would reach out to the support forum for WordPress.org here:
https://wordpress.org/support/forums/
- The topic ‘Need to supply variable to an sql statement.’ is closed to new replies.