Conditon related PHP Question
<pre><code>$output = "&lt;loginsuccess&gt;";

for( $i = 1; $row = mysql_fetch_array($result); $i++ )          {


$output .="&lt;keyword&gt;".$_POST['keyword']."&lt;/keyword&gt;&lt;name&gt;".$row['url']."&lt;/name&gt;&lt;occur&gt;".$row['occurrences']."&lt;/occur&gt;&lt;queryTime&gt;".(substr($end_time-$start_time,0,5))."&lt;/queryTime&gt;";
}

$output .= "&lt;/loginsuccess&gt;";
</code></pre>

<p>I need now a simple condition where if the result is empty then i need to return no inside the xml [ login success ].</p>

<p>Is this a correct way.... </p>

<pre><code>if($row = mysql_fetch_array($result))          {

for( $i = 1; $row = mysql_fetch_array($result); $i++ )          {

$output .="&lt;keyword&gt;".$_POST['keyword']."&lt;/keyword&gt;&lt;name&gt;".$row['url']."&lt;/name&gt;&lt;occur&gt;".$row['occurrences']."&lt;/occur&gt;&lt;queryTime&gt;".(substr($end_time-$start_time,0,5))."&lt;/queryTime&gt;";
} } else { 
    $output.="no"; 
}
</code></pre>
