Closed itsneel closed 9 years ago
Hi @neelanshugoyal ,
As mentioned in the documentation (true there is no example) you need to pass an array of parameters.
So for example, retrieving a user by id :
$query = 'MATCH (user:User) WHERE id(user) = {user_id} RETURN user';
$parameters = array('user_id' => 123);
$result = $client->sendCypherQuery($query, $parameters)->getResult();
You can also use arrays as parameters values, for e.g. retrieving a user who's id is in a collection of ids :
$query = 'MATCH (user:User) WHERE id(user) IN {ids} RETURN user';
$parameters = array('user_id' => array(123, 234, 456));
$result = $client->sendCypherQuery($query, $parameters)->getResult();
In the meantime, I wrote two blog posts on Sitepoint which have more examples in a real use case :
http://www.sitepoint.com/discover-graph-databases-neo4j-php/
http://www.sitepoint.com/adding-social-network-features-php-app-neo4j/
Hope it helps
@ikwattro thanks, for the examples, i ll implement them. And i am closing this issue as well.
also could you please update the documentation so that other can benefit from it. Thanks
How to send params with query while sending query to the database. as in all the examples, i have seen that are fetching some thing and not sending any params with it. Could you guys please post and example explaining how i can do that?