Support » Fixing WordPress » Cant retrieve field value

  • Resolved crashguru


    I need to retrieve and process the value of an input field ( AWPCP plugin).
    I looked up the field’s name in the database: ad_item_price
    I put this code on my page ID6 ( with php plugin):

    [ Moderator note: it’s the backtick character for code and not the single quote. Or use the code button, that works too. ]

    global $post;
    $adbudget = get_post_meta(6, 'ad_item_price', true);

    to see whether I get the value, but no luck. What is wrong?
    Thank you very much in advance for any hints!

    PS I am an old hardware eng., not a php programmer…

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Andrew Nevins


    Forum moderator

    Can you var_dump($adbudget); and see what that returns?

    Moderator Jan Dembowski


    Brute Squad and Volunteer Moderator

    PS I am an old hardware eng., not a php programmer…

    Well that got my interest. 😉

    Which plugin do you mean? This one?

    Knowing which one will make it easier to help you out.

    The var_damp returns bool(false) and yes, that is the plugin.

    Thank you for the quick reply gentlemen!
    Please stay with me… 🙂

    I made a mistake, var_dump($adbudget); returns string(0) ""

    The guy from the AWPCP plugin tries to hold back as much info from his paying customer as he can. At least I learned that the price data is not in a post or page.
    I found a query in one of their files re. the ad_item_price and wanted to try this code

    global $wpdb;
    $tbl_ads = $wpdb->prefix . "awpcp_ads";
    $my_result = $wpdb->get_var( "SELECT ad_item_price FROM ".$tbl_ads.");
    echo $my_result;

    , but it gives a parser error “unexpected end of file”. I cant figure out what is wrong with it.

    Help please !

    This code appears to have the right syntax, but always returns 20000, no matter what the price is.
    global $wpdb;

    $tbl_ads = $wpdb->prefix . "awpcp_ads";
    $my_result = $wpdb->get_var( "SELECT ad_item_price FROM ".$tbl_ads);
    echo $my_result;

    I am running out of ideas …


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cant retrieve field value’ is closed to new replies.