WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Cant retrieve field value

[Resolved] Cant retrieve field value

  • crashguru

    @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. ]

    <?php
    global $post;
    $adbudget = get_post_meta(6, 'ad_item_price', true);
    print($adbudget);
    ?>

    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

    @anevins

    Forum moderator

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

    Moderator Jan Dembowski

    @jdembowski

    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?

    http://wordpress.org/extend/plugins/another-wordpress-classifieds-plugin/

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

    crashguru

    @crashguru

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

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

    crashguru

    @crashguru

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

    crashguru

    @crashguru

    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 !

    crashguru

    @crashguru

    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 …

    crashguru

    @crashguru

    Thanks!

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