What is happening is your while loop for SQL_NumColumns(Query). SQL_NumColumns(Query) only return the numbers of columns from the query. So your while loop will always remain true since SQL_NumColumns(Query) will always return 4 for your 4 columns.
Columns numbers when doing SQL_ReadResult always start from 0. So your incrementing past what is valid.
Code:
new i = 0
new NumColumns = SQL_NumColumns(Query);
while(SQL_MoreResults(Query))
{
while(NumColumns)
{
SQL_ReadResult(Query,i,output[i],31)
server_print("Found data: %s",output[i])
NumColumns--;
i++
}
SQL_NextRow(Query)
}
__________________