I have this piece of PHP code which should accept a number sent from an Android app and search the equivalent to that number in the database (in the other field) and send the result to the Android app.
But I get this error:
Object of class stdClass could not be converted to string in D:\xampp\htdocs\ \b.php
in this line:
mysql_query(" select  stock_account from  Stock where  phone_id=   (string)$data ") 
This is the complete code:
if( isset($_POST["json"]) )
{
    $data = json_decode($_POST["json"]);
    mysql_connect("localhost", "root", "password") or die(mysql_error());
    mysql_select_db("dbname") or die(mysql_error());
    $datatwo = mysql_query(" select  stock_account from  Stock where   id=   (string)$data ") or die(mysql_error()) ;  
    echo $datatwo;
}
 
     
     
    