AQL Query conversion to PHP

php
aql
query

#1

Hi All, Following AQL query is working fine for me SELECT * FROM test.posts IN LIST WHERE ids = 179 I need this record to be fetched in PHP class . how can i write this with query() function ? Please help . Thanks In advance


#2

First, is there a secondary index for type LIST over the ids bin of test.posts? If not, you’ll need to create it for the query to execute.

In the PHP client you’ll be using predicateContains() with your query(). For example:

$results = [];
$where = Aerospike::predicateContains("ids", Aerospike::INDEX_TYPE_LIST, 179);
$status = $client->query("test", "posts", $where, function ($record) use (&$results) {
    $results[] = $record['bins'];
});

#3

Thank you very much @rbotzer . This is working fine for me . You are a Rockstar . :smile: