Could you please tell me which command line can help me to reinitialize a neo4j query, to explain more, I have a query which gives all users nodes and the second query gives folders nodes, unfortunately, the second query remember the result of the first query.
EDIT 0
Here follows a concatenation of additional information that OP posted as answers. To the one who is able, please merge the edits and remove this comment.
EDIT 1
<td>
<select name=user>
<?php
$result1 = $client->sendCypherQuery("MATCH (n:$label1) return n")->getResult();
$i=0;
foreach ($result1->getNodes() as $nu){
$n[$i]=$nu->getproperty('lastname');
$i++;
}
while ($j<$i)
{
echo "<option value='$n[$j]'> $n[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td>Nom dossier :</td>
<td>
<select name=folder>
<?php
$result2 = $client->sendCypherQuery("MATCH (n:$label2) return n")->getResult();
$i=0;
foreach ($result2->getNodes() as $nd){
$d[$i]=$nd->getProperty('name');
$i++;
}
$j=0;
while ($j<$i)
{
echo "<option value='$d[$j]'> $d[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
</td>
</tr>
EDIT 2
I have 2 users and 2 folders.
$result1
should return the users and $result2
should return the folders.
when I look for the size of folders I get 4 and not 2 so the query remembers always the result of the first query.
EDIT 3
var_dump($result1)
, I get:
object(Neoxygen\NeoClient\Formatter\Result) protected 'nodes' =>
array (size=2)
7 =>
object(Neoxygen\NeoClient\Formatter\Node)[796]
protected 'id' => string '7' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
9 =>
object(Neoxygen\NeoClient\Formatter\Node)[797]
protected 'id' => string '9' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
... protected 'relationships' =>
array (size=0)
empty protected 'errors' => null
protected 'identifiers' =>
array (size=1)
'n' =>
array (size=2)
0 =>
object(Neoxygen\NeoClient\Formatter\Node)[796]
...
1 =>
object(Neoxygen\NeoClient\Formatter\Node)[797]
...
EDIT 4
and var_dump($result2)
:
object(Neoxygen\NeoClient\Formatter\Result) protected 'nodes' =>
array (size=4)
7 =>
object(Neoxygen\NeoClient\Formatter\Node)[799]
protected 'id' => string '7' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
9 =>
object(Neoxygen\NeoClient\Formatter\Node)[800]
protected 'id' => string '9' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
8 =>
object(Neoxygen\NeoClient\Formatter\Node)[787]
protected 'id' => string '8' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=2)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
10 =>
object(Neoxygen\NeoClient\Formatter\Node)[788]
protected 'id' => string '10' (length=2)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=2)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
EDIT 5
<?php include 'connection.php';
$j=0;
$l=0;
$label1="user";
$label2="folder1";
?>
<br><br><br>
<h3>Ajouter relation</h3>
<form action='php/addlink.php' method=post>
<table>
<tr>
<td>Nom utilisateur:</td>
<td>
<select name=user>
<?php
$result1 = $client->sendCypherQuery("MATCH (n:$label1) return n")->getResult();
$i=0;
foreach ($result1->getNodes() as $nu){
$n[$i]=$nu->getproperty('lastname');
$i++;
}
while ($j<$i)
{
echo "<option value='$n[$j]'> $n[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td>Nom dossier :</td>
<td>
<select name=folder>
<?php
$result2 = $client->sendCypherQuery("MATCH (n:$label2) return n")->getResult();
$i=0;
foreach ($result2->getNodes() as $nd){
$d[$i]=$nd->getid();
$i++;
}
$j=0;
while ($j<$i)
{
echo "<option value='$d[$j]'> $d[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
This is really strange, I have created an integration test which proves that results are not duplicated in subsequent queries :
https://github.com/neoxygen/neo4j-neoclient/blob/master/tests/Neoxygen/NeoClient/Tests/Issues/IssueSOResultDuplicationTest.php
So I would look on different positions :
NB: You can edit your original question instead of creating multiple replies.
I have test your code, just replacing the labels with those in my db, and I only get 2 folders :
So I would check the db content, can you try in your browser to make the second query manually.