php:Select语句仅在Linux Mint中抛出错误

I have assigned a variable

$car = $variable; // $variable gets a value from post method and it is an integer.

I have written a select statement:

$sql ="SELECT data FROM thisTable WHERE value='$car'";

I wrote this code in Windows and it was working fine. I tried to execute the same in lampp in LinuxMint and it thows the error

Trying to get property of non-object.

I'm learning PHP so not sure about the error, can anyone tell me why this is happening?