だから私はMySQLテーブルを持っています:
Table Data:
id | domain | title | Full Url to Page | ... etc ...
1 | place.com | Place Something | http://place.com/1...
2 | place.com | Place Something Else | http://place.com/2...
3 | place.com | Some Other Place | http://place.com/3...
4 | pets.com | Cats Dogs Oh My | http://pets.com/2....
5 | pets.com | Bird Edition | http://pets.com/3....
(PHP/JQuery で) 必要なのは、一意のドメインごとに ID の配列を取得することです。したがって、上記の表に必要な最終出力は次のとおりです。
$finalArray = array('place.com' => array(1, 2, 3), 'pets.com' => array(4, 5));
私の現在の解決策は、ドメインで並べ替えられたすべての行を取得することです。MySQL ステートメントは次のとおりです。
SELECT `id`, `domain` FROM `gsort_linkdata` ORDER BY `domain`
どちらが返されますか:
1 | place.com
2 | place.com
3 | place.com
4 | pets.com
5 | pets.com
次に、PHP で行をループ処理し、それらを配列に分割します。データベースからすでに分割されているデータを取得したいと思います。それは可能ですか?ありがとうございました!