gpt4 book ai didi

php - php中如何从对象中获取对象的值?

转载 作者:行者123 更新时间:2023-11-29 11:19:06 25 4
gpt4 key购买 nike

我正在从成员表中选择一列。现在我想从该列中获取值。但是当我尝试获取该值时,我收到一个异常:

 <br />
<b>Notice</b>: Trying to get property of non-object in
<b>C:\Program Files (x86)\Ampps\www\MLMapi\PurchaseProduct.php</b> on line
<b>54</b>
<br />

代码:

    $stmt = $dbConnection->prepare("select Member.sales_hold_fund from Member where member_id=?");
$stmt->execute(array($member_id));
$member = $stmt->fetch(PDO::FETCH_ASSOC);

$fund = $member-> sales_hold_fund;// line54

$sales_hold_fund = $fund + $amount;

我想从数据库获取 sales_hold_fund 值并将金额值添加到 sales_hold_fund。

成员(member)值(value):

 "Member": {
"sales_hold_fund": "1000"
}

有人可以帮忙吗?谢谢..

最佳答案

尝试

 $fund = $member['sales_hold_fund'];

关于php - php中如何从对象中获取对象的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39249464/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com