Doesn't look wrong - are you sure it's the SQL Server that's the problem? The error suggests that the SQL Server call didn't return a result set. I assume if you have something like
Code:
$result = mysql_query($recent_sql, $link_id) or die('Query failed: ' . mysql_error().'<br>'.$query);
$row = mysql_fetch_row($result) or die(mysql_error());
that would tell you more about the problem - I'm guessing it's either a field/table name issue or the $link_id.