Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
The wpdb class, accessed via the $wpdb global variable, is used to interact with the WordPress database
0
votes
Make a SQL query with wpdb in WordPress
meta key
$sql = $wpdb->prepare (
"SELECT min(TIMESTAMPDIFF($day,fecha_inscripcion, $now))
FROM {$wpdb->prefix}cf7dbplugin_submits
WHERE field_name=%s and field_value=%s",
$fieldname, … $fieldvalue
);
$post_count = $wpdb->get_var($sql) ;
echo "<p>User count is {$post_count}</p>"; …
0
votes
2
answers
894
views
Make a SQL query with wpdb in WordPress
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)) …