• 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.

Viewing 1 replies (of 1 total)
  • Topher

    (@topher1kenobe)

    Try storing the query in a variable, and then print the variable, so you see query as it’s being sent to the database.

    Then try running the query directly in phpMyAdmin or something like it and see if the query works. If the query works then it’s something else in your code.

Viewing 1 replies (of 1 total)
  • The topic ‘Need to get data from plugin table’ is closed to new replies.