new result[24], // or whatever the max length of the name of a company is output[240];while(mysql_fetch_row(result)){ strcat(output, result); strcat(output, "\n");}