This is how I am making my array; But it appears that this array is only grabbing the data from the last row. How can I get $theinfo to store the data from all the rows? $query1 = "SELECT t1.* FROM profile_values AS t1 INNER JOIN profile_values AS t2 USING (uid) WHERE t2.fid=4 AND t2.`value`='1' AND t1.fid!=4"; $q1 = mysql_query($query1); while($res1 = mysql_fetch_array($q1)){ $theinfo[$res1['fid']] = $res1['value']; }
If the fid column is unique, it should. If it's not, you'll have to use a unique column for the array key, or just increment it. i.e. $theinfo[$res['unique_column']] = $res1['value']; Code (markup): or: $theinfo[] = $res1['value']; Code (markup):
Why would you make an array of a database result. You normally need to loop through the array to get the values. This is redundant and creates unnecessary overhead.