This is the free version, so also the premium one.
First: Click on "Add field" on the left

Then use the first radio button and select "SQL Query"
The textarea will use %%ID%% as the entry id in a neat $wpdb->prepare statement.
if (!empty($fieldSql)) {
global $wpdb;
$val = $wpdb->get_var($wpdb->prepare(stripcslashes(str_replace("%%ID%%", "%d", $fieldSql)), $entry->ID));

Warning: you may use any query as long as it returns just one variable. Also you can only use %%ID%%, and not others. It is possible to use shortcodes or even eval (! I don't think you want to use this. !) on the return value of that query. ( might need 1 or 2 other input fields, the one just below the textarea is the fieldPHP, but does not work in the free version ).
Leave a Reply