atticus Posted June 27, 2010 Share Posted June 27, 2010 Hi all, I want to put the data from MySQL into a regular array so that I can use array_unique to to remove duplicate data. I need all three variables to be associated with one index point. $months = array(); $i = 0; while($row = mysql_fetch_array($query)) { $monthname = $row['MONTHNAME(`time`)']; $year = $row['YEAR(`time`)']; $month = $row['MONTH(`time`)']; $months[] = ($i => $monthname,$year, $month); $i++; Link to comment https://forums.phpfreaks.com/topic/205966-mysql-row-to-array-syntax-question/ Share on other sites More sharing options...
Alex Posted June 27, 2010 Share Posted June 27, 2010 You can prevent duplicate rows by using a DISTINCT clause in your SQL query. That's more of a MySQL question though, so if you want help with that head over the MySQL help forum. Link to comment https://forums.phpfreaks.com/topic/205966-mysql-row-to-array-syntax-question/#findComment-1077749 Share on other sites More sharing options...
atticus Posted June 27, 2010 Author Share Posted June 27, 2010 Distinct, of course! Dr. Qu would be shaking his head after spending countless hours trying to pump that db stuff in my head back in the day...thanks for pointing me in the right direction. Link to comment https://forums.phpfreaks.com/topic/205966-mysql-row-to-array-syntax-question/#findComment-1077750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.