最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Get records from Formidable Table using $wpdb->get_col

programmeradmin2浏览0评论

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 1
Add a comment  | 

1 Answer 1

Reset to default 0

Try 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;

?>
发布评论

评论列表(0)

  1. 暂无评论