find using query in PHP

Good Day,

Im doing a find by query using PHP SDK. Here is the code:

In my TABLE Deal I have a column (merchantId)

$sql_var = ‘some ID’;
$query = new BackendlessDataQuery();
$query->setWhereClause(“merchantId = ‘$sql_var’”);
$deals = Backendless::$Data->of(“Deal”)->find($query);

But I received the following error:

Uncaught exception ‘backendless\exception\BackendlessException’ with message 'Backendless API return error: Invalid where clause: Unknown column ‘where clause. Error code:1017’ in \backendless\src\lib\RequestBuilder.php:162 Stack trace: #0 \backendless\src\lib\RequestBuilder.php(68): backendless\lib\RequestBuilder::handleError(Object(backendless\lib\HttpRequest)) #1 \backendless\src\lib\RequestBuilder.php(41): backendless\lib\RequestBuilder::doRequestByUrl(‘https://api.bac…’, NULL, ‘GET’) #2 \backendless\src\services\Persistence.php(201): backendless\lib\RequestBuilder::doRequest(‘data’, ‘Deal?where=merc…’, NULL, ‘GET’) #3 \view_deal.php(15): backendless\services\Persistence->find(Object(backendless\services\persistence\BackendlessDataQuery)) #4 {main} thrown in \backendless\src\lib\RequestBuilder.php on line 162

Any Idea?

Thank you.

Do you use latest php sdk?


Hi Kate,


Try changing the line of code where you set the where clause to:

$query->setWhereClause("merchantId.objectId = '$sql_var'");