Hai folks,
This crazy error driving me nuts.
i can’t supply a eliment position in a variable. example : wp:listing[$x] (the $x value actually here is 1). But this does not work.
The error was : Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: xmlXPathEval: 1 object left on the stack in /homepages/…
but if i specify the position manually it works : example wp:listing[1]
what could be wrong? if i specify a value manually it works correctly. but if i supply the same value using a variaible, then the above error occours. pls help!
$p=1;
for ($x=1;$x<=$totfound;$x++){
$result = $xml->xpath('//[B]wp:listing[$x][/B]/wp:people/wp:person[@wp:rank="secondary"]/wp:firstname');
if ((count($result))>0){
foreach ($result as $key => $value){
$related[$x][$p]=$value;
$p++;
}
}else{
$related[$x][1]="non";
}
}