我有这段代码:
$polaczenie = @new mysqli($host, $db_user, $db_password, $db_name); ...
... $result2 = mysqli_query($polaczenie, "SELECT money FROM roulette.users WHERE
userSteamID='$SteamID'");
while($row = mysqli_fetch_assoc($result2)){
print_r($row);
}
我得到了这个结果:Array ( [money] => 15 )
,
但我希望如此:var $money = 15
如何将mysqli_result类的Object转换为String?
答案 0 :(得分:1)
你可以试试这个:
$money;
while($row = mysqli_fetch_object($result2)){
$money = $row->money;
}
echo $money;