I am using Formidable Pro as a CRM and one form has a field called cust_id.
Now I want to get all the records stored within that form with a specific cust_id.
I did:
$form_id = 7; $search_id = 300;
$entries = $wpdb->get_col( $wpdb->prepare("SELECT id FROM ". $wpdb->prefix ."frm_items WHERE cust_id = %d AND form_id = %d", $search_id, $form_id) );
But the $entries are empty ??
And there are a few records with the search_id.
Any suggestions on what I am doing wrong ?
I am using Formidable Pro as a CRM and one form has a field called cust_id.
Now I want to get all the records stored within that form with a specific cust_id.
I did:
$form_id = 7; $search_id = 300;
$entries = $wpdb->get_col( $wpdb->prepare("SELECT id FROM ". $wpdb->prefix ."frm_items WHERE cust_id = %d AND form_id = %d", $search_id, $form_id) );
But the $entries are empty ??
And there are a few records with the search_id.
Any suggestions on what I am doing wrong ?
Share Improve this question asked Oct 29, 2019 at 12:58 FredWFredW 11 Answer
Reset to default 0Try this:
<?php
global $wpdb;
$table_name = $wpdb->prefix.'frm_items';
$row_values = $wpdb->get_results("SELECT * FROM {$table_name} WHERE id = 1");
echo $row_values[0]->cust_id;
?>