displaying errors to the user
<p>I send a seach item to the server and the server returns results in xml.I realise that it returns blank when no match is found on the server database or other errors from the server. The results are displayed to the user if they are found. i want to display the error message to the user when the search result is blank and also display other errors that the server might return when a search is made to it. the format in which errors are returned as xml is as below. </p>

<pre><code>&lt;errors&gt;
&lt;error code =1234&gt;
 &lt;message&gt; error message&lt;/message&gt;
&lt;/error&gt;
&lt;/errors&gt;
</code></pre>

<p>And the search results are also returned in the format</p>

<pre><code>&lt;searches&gt; 
&lt;search id ='1234'&gt;
&lt;name&gt; somename &lt;/name&gt;
&lt;address&gt; some address &lt;/address&gt;
&lt;sector&gt; some sector &lt;/sector&gt;
&lt;contacts&gt; 12345, me@me.com &lt;/contacts&gt;
&lt;searches&gt;
</code></pre>

<p>this is the loop that displays successful results to user.</p>

<pre><code>&lt;?php
$obj = simplexml_load_string($result);//result is containing the result
foreach($objj as $searches): 
echo $searches -&gt; name 
 endforeach
?&gt;
</code></pre>

<p>I have to always check whether the root node is  else i display the error message but it seem its not working. Any help.Thanks in advance</p>
