rajmohan Posted October 27, 2007 Share Posted October 27, 2007 ------------------------- price name --------------------------- aa one bb two cc one dd two ee two ff two ---------------------------- I want out put as --------- sample ---------- one aa cc two bb dd ee ff -------- Any one guess it with Link to comment https://forums.phpfreaks.com/topic/74969-mysql-query-doubt-very-intresting/ Share on other sites More sharing options...
Psycho Posted October 27, 2007 Share Posted October 27, 2007 <?php $query = "SELECT name, price FROM table ORDER BY name, price"; $result = mysql_query($query) or die (mysql_error()); $current_name = ""; while ($record = mysql_fetch_assoc($result)) { if ($record['name'] != $current_name) { $record['name'] = $current_name; echo "$current_name<br>\n"; } echo "$record['price']<br>\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/74969-mysql-query-doubt-very-intresting/#findComment-379122 Share on other sites More sharing options...
trq Posted October 27, 2007 Share Posted October 27, 2007 You might want to read the Howto ask... link in my signature. Your post is bordering on ridiculous. Link to comment https://forums.phpfreaks.com/topic/74969-mysql-query-doubt-very-intresting/#findComment-379128 Share on other sites More sharing options...
Recommended Posts