我想从特定日期的最后一个插入行中显示一个字段(bal)。
$BALdata171201 = ORM::for_table('sys_transactions')->where('date',$data171201)->select('bal')->order_by_desc('id')->limit(1)
但我不断收到错误:
可捕获的致命错误:无法将类 ORM 的对象转换为字符串
如何在字符串中进行 ORM 对象转换?
对于这个问题,我已经阅读了几十个答案,但我没有找到任何解决方案。
如果我使用var_dump我得到:
object(IdiormResultSet)#132 (1) {
["_results":protected]=>
array(1) {
[0]=>
object(ORM)#131 (22) {
["_connection_name":protected]=>
string(7) "default"
["_table_name":protected]=>
string(16) "sys_transactions"
["_table_alias":protected]=>
NULL
["_values":protected]=>
array(0) {
}
["_result_columns":protected]=>
array(1) {
[0]=>
string(1) "*"
}
["_using_default_result_columns":protected]=>
bool(true)
["_join_sources":protected]=>
array(0) {
}
["_distinct":protected]=>
bool(false)
["_is_raw_query":protected]=>
bool(false)
["_raw_query":protected]=>
string(0) ""
["_raw_parameters":protected]=>
array(0) {
}
["_where_conditions":protected]=>
array(0) {
}
["_limit":protected]=>
NULL
["_offset":protected]=>
NULL
["_order_by":protected]=>
array(0) {
}
["_group_by":protected]=>
array(0) {
}
["_having_conditions":protected]=>
array(0) {
}
["_data":protected]=>
array(1) {
["bal"]=>
string(7) "1354.00"
}
["_dirty_fields":protected]=>
array(0) {
}
["_expr_fields":protected]=>
array(0) {
}
["_is_new":protected]=>
bool(false)
["_instance_id_column":protected]=>
NULL
}
}
}
我已经尝试过 $BALdata171201string = $BALdata171201string->_data; 但我得到了一个空的回声。