Search code examples
phpobjectstdclassezsql

ezSQL - Object of class stdClass could not be converted to string


i create my own function with count of data.

Here is my function.

   function  Test($data){
     global $acc;
     $count = $acc->get_var("SELECT Count(*) FROM _users WHERE ID='$data'");
     if($count == 0)
     {
       return true;
     }else{
       return false;
     }
   }

But i got This is error : "PHP Catchable fatal error: Object of class stdClass could not be converted to string In This is Line $count = $acc->get_var("SELECT Count(*) FROM _users WHERE ID='$data'"); I try var_dump in function and Other ezSQL methods (query,num_rows) but i got every same error.

-- Edit: Problem solved. I wrong posted $data


Solution

  • Please make sure that

    $data
    

    is not an array