我有一個MySQL查詢切片一個MySQL陣列
$raw_resultsplaylists = mysql_query("SELECT songs.*, playlists.title as `playlist_title`
FROM song_main AS songs
JOIN songs_in_list AS playlist_songs
ON songs.ID = playlist_songs.song_id
JOIN playlists
ON playlist_songs.playlist_id = playlists.ID
WHERE playlists.owner_id = '$userid'") or die(mysql_error());
檢索的信息,如一個數組:
playlist_title song_name song_url song_artist
-------------------------------------------------------------------
foo1 woops www. -
foo1 blah www. -
foo2 blop www. -
foo1 woop www. -
foo3 bob www. -
foo1 dylan www. -
我的問題是我怎麼可以切片Mysql的陣列來獲得所有的行在同一playlist_title
在一個單獨的陣列,所以我可以在單獨的html表格中顯示它們,例如:
html表格1:
playlist_title song_name song_url song_artist
-------------------------------------------------------------------
foo1 woops www. -
foo1 blah www. -
foo1 woop www. -
foo1 dylan www. -
HTML表2
playlist_title song_name song_url song_artist
-------------------------------------------------------------------
foo2 blop www. -
foo2 dylan www. -
等等
在哪裏查詢? – Raptor
你可以使用GROUP_BY –
請問我可以在不同的html表格中顯示不同的數組嗎? – anto0522