Change queryOneRow to check if LIMIT is in the query, tack on LIMIT 1 if not to prevent queryArray from running out of RAM on large data sets.