Support » Plugins » Using variables in wpdb calls?

  • Hi, quick question. Im working with WPMU -but just now I have a query to do with the general WPDB calls.

    I have a query that pulls the blog_id from the blogs table. I then go into a loop. In that loop, I want to use a query similar to:

    $wpdb->query(“SELECT * FROM {$wpdb->$VARIABLE_posts}”);

    Basically the variable is passed from the first query (say the number 4). It should then be dumped into the second query, so that the second query turns out to be:

    $wpdb->query(“SELECT * FROM {$wpdb->4_posts}”);

    but its just now happening. Am I trying too hard and theres a simple way of doing it? Or am I missing something else?

    Thanks in advance for the help!


Viewing 3 replies - 1 through 3 (of 3 total)
  • anyone? sorry to bump – but im scratching my head here! 🙂


    Erm, are you trying to pass the same $var to each query? or are you trying to pass the result from the first query into the second query?

    i have one query that grabs the variable
    the second query (above) uses that variable
    it then loops back to the first query and repeats it..


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using variables in wpdb calls?’ is closed to new replies.