0

I have this code:

$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);
}

and I get this result: Array ( [money] => 15 ),

but I want this: var $money = 15

How to convert Object of class mysqli_result to String?

I tried many options for example this or this.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hubert Hubert
  • 77
  • 3
  • 14

1 Answers1

1

you can try this:

$money;
while($row = mysqli_fetch_object($result2)){
   $money = $row->money;
}

echo $money;
Madhu
  • 326
  • 2
  • 7