I have a problem whenever I query and display my resulted items. I am using PHP and MSSQL for my database. I have no problem when I query from the database but when I added an "if" statement so that to display "NO RECORDS FOUND" the problem arises.
Here's my code where I think the problem is:
//Show results in table
if(sqlsrv_num_rows($result)>0){
$o = '<table id="myTable">
<thead>
<tr>
<th>Name</th>
<th>Age </th>
<th>Sex</th>
</tr>
</thead><tbody>';
while ( $record = sqlsrv_fetch_array($result) )
{
$o .= '<tr><td>'.$record ['Name'].'</td><td>'.$record ['Age'].'</td><td>'.$record ['Sex'].'</td></tr>';
}
$o .= '</tbody></table>';
echo $o;
}
else{
echo "No records found";
}
whenever I search for a data it always display No records found even if the data is stored in the database. Help please? newbie here