johnhb Posted March 12, 2008 Share Posted March 12, 2008 I have the following code: $query=mysql_query('SELECT pay, name FROM paychart, users WHERE paychart.payee = users.id') or die(); which I want to put into an array so that I can 1) eliminate duplicate values of pay and then 2) find the lowest value of pay and have the payee's name to match that pay. I have tried this: while ($array = mysql_fetch_array($query, MYSQL_NUM)) { $data[] =$array[0]; $data1[] =$array[1]; } But I want the pay and name to be in the same array. Hope someone can help me? Link to comment https://forums.phpfreaks.com/topic/95760-fill-an-array-from-a-mysql-query/ Share on other sites More sharing options...
Barand Posted March 12, 2008 Share Posted March 12, 2008 while ($array = mysql_fetch_row($query)) { $data[] =$array; } Link to comment https://forums.phpfreaks.com/topic/95760-fill-an-array-from-a-mysql-query/#findComment-490282 Share on other sites More sharing options...
johnhb Posted March 12, 2008 Author Share Posted March 12, 2008 Thank you very much - it's so simple when you know how. Link to comment https://forums.phpfreaks.com/topic/95760-fill-an-array-from-a-mysql-query/#findComment-490301 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.