1. You have no </td>'s or </tr>'s
2. You can eliminate the SQL_FieldNameToNum() native calls by passing the column number directly to SQL_ReadResult().
3. You can replace formatex() with copy() on your first 5 formatex()'s.
Try this
PHP Code:
while (SQL_MoreResults(Query))
{
len += formatex(gMotd[len], charsmax(gMotd) - len, "<tr><td>%d</td>", ++k);
SQL_ReadResult(Query, iName , szName, charsmax(szName));
len += formatex(gMotd[len], charsmax(gMotd) - len, "<td>%-22.22s</td>", szName);
len += formatex(gMotd[len], charsmax(gMotd) - len, "<td>%d</td>", SQL_ReadResult(Query, iKills ));
len += formatex(gMotd[len], charsmax(gMotd) - len, "<td>%d</td>", SQL_ReadResult(Query, iDeaths ));
len += formatex(gMotd[len], charsmax(gMotd) - len, "<td>%d</td></tr>", SQL_ReadResult(Query, iHeadshots ));
SQL_NextRow(Query);
}
__________________