Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Object of class PDOStatement could not be converted to int

Posted on 2010-09-14
4
Medium Priority
?
1,413 Views
Last Modified: 2012-05-10
what could this error mean

I am using php and sql server (pdo)
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Expert Comment

by:Amar Bardoliwala
ID: 33679272
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
 
LVL 2

Expert Comment

by:ciprian-dobrea
ID: 33680365
Could you paste the error line in please?
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 33690839
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
 

Author Closing Comment

by:rgb192
ID: 33711871
thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question