SELECT ARRAY(SELECT t_data FROM THETABLE WHERE t_ref_id = '1') AS v;
In PHP you may fetch all matched values as a single string and then - use explode() to split it into values (possibly with later stripslashes). It is much faster than fetching a thousands of rows.