How to get all the data from contact form 7 database in file function.php
-
Hi, all,
I have contact form 7 database Addon installed, and it contains a product order table. I want to prevent the customer from entering the duplicated order numbers. So, I added some code snippets in function.php. The first thing I am trying to do is to get all the data existing in the product order table but fail. The testing code below is to make sure I can access that table, the $total it returned is not the correct number.add_filter( ‘wpcf7_validate_email*’, ’email_already_in_db’, 10, 1);
function email_already_in_db ( $result, $tag ) {
global $wpdb;
$cfdb = apply_filters( ‘cfdb7_database’, $wpdb );
$table_name = $cfdb->prefix.’db7_forms’;
$total_query = “SELECT COUNT(*) FROM” + $table_name;
$total = $cfdb->get_var( $total_query );
if($total == 1){
$result->invalidate($tag, $total);
}
return $result;
}The page I need help with: [log in to see the link]
- The topic ‘How to get all the data from contact form 7 database in file function.php’ is closed to new replies.