Support » Plugins » phpexec and wpdb problem

  • brooklynwebguy

    (@brooklynwebguy)


    Hi —

    I am having trouble using the wpdb object inside the <phpcode> tags of php exec. When I attempt to access wpdb with code that works when placed directly in a template, I get the following error when I put it in a post via phpexec:

    “Call to a member function on a non-object”

    Is there any way to fix this?

    It seems the combination of phpexec and the wpdb object are very powerful. I would be grateful for any help from an experienced hand.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Kafkaesqui

    (@kafkaesqui)

    Try scoping $wpdb as global first in your <phpcode> call:

    <phpcode>
    global $wpdb;
    ~the rest of your code~
    </phpcode>

    brooklynwebguy

    (@brooklynwebguy)

    That did it.

    Thanks!

    That’s quite a useful plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘phpexec and wpdb problem’ is closed to new replies.