Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1569
  • Last Modified:

Object of class PDOStatement could not be converted to int

what could this error mean

I am using php and sql server (pdo)
0
rgb192
Asked:
rgb192
1 Solution
 
Amar BardoliwalaCommented:
Hello rgb192,

above error says that you are trying to assign variable containing "Object of class PDOStatement" to variable of type int or variable which can store int only.

Thanks.
0
 
ciprian-dobreaCommented:
Could you paste the error line in please?
0
 
Ray PaseurCommented:
Please install this code snippet and run it -- you will see how the error is caused.  It is undoubtedly a program logic error.  Look at the line number in your error message to find the failing instruction.
<?php // RAY_temp_rgb192.php
error_reporting(E_ALL);
echo "<pre>";

// CREATE A CLASS DEFINITION
class Thing
{
    public $value;
    public function __construct()
    {
        $this->value = 'Hello World';
    }
}

// INSTANTIATE AN OBJECT
$x = new Thing;
echo $x->value;

// TRY TO CONVERT THE OBJECT TO AN INTEGER
$y = (int)$x;

// TRY IT AGAIN
if ($x > 3) echo "WE COMPARED AN OBJECT TO AN INTEGER";

Open in new window

0
 
rgb192Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now