• Resolved Budi Haryono

    (@jbsindonesia)


    Hello @tobiasbg

    I create variable to show my table as dynamic (pull from my ACF field).

    In ACF field value is my table ID which is the number only.

    Here is my code:

    <?php
    $tablid = get_field(‘dest_pricing’);
    // this just test it work echo $tablid;
    tablepress_print_table( array( ‘id’ => echo $tablid ) );
    ?>

    but I found error

    Parse error: syntax error, unexpected ‘echo’ (T_ECHO)

    Please help

    Thank you so much

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    It is the wrong approach. you can’t echo inside the array.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    You actually don’t need to echo here, but only use

    <?php
    $table_id = (string) get_field( 'dest_pricing' );
    tablepress_print_table( array(
      'id' => $table_id,
    ) );
    ?>

    Regards,
    Tobias

    Thread Starter Budi Haryono

    (@jbsindonesia)

    @tobiasbg

    Working PERFECT

    screenshoot

    Thank you so much and for @astra001 thanks too

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias
    ?
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Echo Variable As Table ID’ is closed to new replies.