mates, please can you help me with the following sql query attempt. This query controls whether a person has performed a form action for 24 hours.
This is the SQL:
SELECT min(TIMESTAMPDIFF(DAY, `fecha_inscripcion`, now())) FROM `wp_cf7dbplugin_submits` WHERE `field_name`="cedula" and `field_value` = "1144093762"
This is the result:
min(TIMESTAMPDIFF(DAY, `fecha_inscripcion`, now()))
5
Now, in WordPress I did so
global $wpdb;
$day = 'DAY';
$now = 'now()';
$fieldvalue = '1144093762';
$fieldname = 'cedula';
$post_count = $wpdb->get_var("
SELECT min(TIMESTAMPDIFF($day,$wpdb->cf7dbplugin_submits.fecha_inscripcion, $now))
FROM $wpdb->cf7dbplugin_submits
WHERE field_name=$fieldname and field_value=$fieldvalue");
print_r($post_count);
echo "Resultado"+$post_count;
But it returns me in 0, when it should be 5 in this case.
Thank
$wpdb->cf7dbplugin_submits.fecha_inscripcion