![](/img/trans.png)
[英]PHP get string value from Assoc array and convert it to string for comparison
[英]how get the value from assoc array using php
Array([0] => stdClass Object([max(Transaction_id)] => 10251))
我的php sql查询以这种格式返回答案。
如何显示这种格式的唯一值。
提前致谢
在查询中添加as
然后添加要检索的列的名称。
SELECT MAX(COLUMNNAME) AS example example FROM TABLENAME
然后在你的php文件中
echo $result[0]['example'];
如果由于某些原因您无法转换sql查询,则可以通过以下方式访问此变量
echo $obj->{"max(Transaction_id)"};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.