mysqli_prepare()
returns a statement object or FALSE if an error occurred. Seems that prepare failed and assigned a boolean to $stmt
. I speculate that prepare failed because $query_insert_trade
isn't defined. You probably mean
$stmt = $db->prepare($query_insert_items);