You have several things going on there and I may not be able to sort them all out.
- Unless
$wpdb->cf7dbplugin_submits
has been added to the$wpdb
object your query won’t work. You will need something like
{$wpdb->prefix}cf7dbplugin_submits
instead but I can’t really
guess at the right value. - You don’t need to swap in 9999. That is a hard-code value. Swapping
it in withprepare
is a waste of resources. - Prepare accepts 3 different placeholders, one for a string, one for
a digit, and one for float. By using%d
you are truncating your
decimal. You need%f
.
Perhaps something like this will work better:
$query =
"SELECT submit_time, form_name, field_value" .
"FROM {$wpdb->prefix}cf7dbplugin_submits " .
"WHERE field_order = 9999 AND submit_time = %f ";
$queryp = $wpdb->prepare($query, $postid);
Item #2 won’t cause a failure of the query, but item #1 would, so that is where I am betting this goes wrong. However, item #3 would just as likely break the query as you would not get a match on a decimal value if the decimal input was truncated to an integer.