データのクエリで問題が発生しています。if 内の if else 条件でクエリを開始する場所がわかりません。
問題は次のとおりです。タイプ = cpmおよびend_date < now()の場合にクエリを実行し、結果の値のタイプをbeforeに変更し、タイプ = cpmおよびend_date > now()の場合に結果の値のタイプをafter に変更する方法。テーブルにデータがあり、結果は次のとおりです。
そして、私は以下のように結果を得たい:
Array(
[0] => Array
(
[id] => 1
[type] => free
[end_date] => 2013-06-20
)
[1] => Array
(
[id] => 4
[type] => after
[end_date] => 2013-08-29
)
[2] => Array
(
[id] => 5
[type] => before
[end_date] => 2013-06-20
)
)
前もって感謝します。