Reputation: 1441
How to pass parameters for WHERE condition?
That it is, this works fine:
match (b:Book) where b.guid={guid} return b;
But, how to pass multiple guids as parameters for this query:
match (b:Book) where b.guid in [guid1,guid2,gid3] return b;
I am using neo4jphp client, my code is like this:
$client = new Everyman\Neo4j\Client( "neo4j server address", "7474" );
$result = new Everyman\Neo4j\Cypher\Query( $client, "match (b:Book) where b.guid={guid} return b", array('guid'=>$guid1) );
$res = $result->getResultSet();
Upvotes: 1
Views: 743
Reputation: 20185
You should pass an array as parameters, the query would look like this :
match (b:Book) where b.guid in {myMap} return b;
$client = new Everyman\Neo4j\Client( "neo4j server address", "7474" );
$result = new Everyman\Neo4j\Cypher\Query( $client, "match (b:Book) where b.guid in {MyMap} return b", array('myMap'=> array($guid1, $guid2, $guid3)) );
$res = $result->getResultSet();
Upvotes: 1