-3

Getting Fatal error:

Uncaught Error: Call to a member function fetchAll() on boolean in /customers/d/8/0/csgotail.com/httpd.www/bot-withdraw.php:12 Stack trace: #0 {main} thrown in /customers/d/8/0/csgotail.com/httpd.www/bot-withdraw.php on line 12 in this code.

<?php
include 'default.php';
$db = getDB();

# Get bot inventory
$bot64Id = '76561198252557804';
$botInventory = json_decode(file_get_contents("https://steamcommunity.com/tradeoffer/new/?partner=292292076&token=j4qmPUCn"), true);
$rgInventory = $botInventory['rgInventory'];

# Get current pot
$stmt = $db->query('SELECT * FROM currentPot');
$currentPot = $stmt->fetchAll();

echo jsonSuccess(array('rgInventory' => $rgInventory, 'currentPot' => $currentPot));
?>
General Grievance
  • 4,555
  • 31
  • 31
  • 45

2 Answers2

2

This error means means that your query is the issue. check your database call or sql query.

"An empty array is returned if there are zero results to fetch, or FALSE on failure. " from http://php.net/manual/en/pdostatement.fetchall.php

gavgrif
  • 15,194
  • 2
  • 25
  • 27
0
$stmt = $db->query('SELECT * FROM currentPot');
if($stmt){
    $currentPot = $stmt->fetchAll();
}

Check if the query executed or not before using the function fetchAll(). Your query probably returned nothing, so, $stmt is false, and so its saying boolean.

Parthapratim Neog
  • 4,352
  • 6
  • 43
  • 79