Ben aşağıdaki dizi çıkışları var.
Array
(
[day] => 17
[eventContent] => event 1 of 17th
[eventTitle] => 17th event 1
)
Array
(
[day] => 19
[eventContent] => event 1 of 19th
[eventTitle] => 19th event 1
)
Array
(
[day] => 05
[eventContent] => event 1 of 5th
[eventTitle] => 5th event 1
)
Array
(
[day] => 17
[eventContent] => event 2 of 17th
[eventTitle] => 17th event 2
)
Array
(
[day] => 19
[eventContent] => event 2 of 19th
[eventTitle] => 19th event 2
)
Array
(
[day] => 19
[eventContent] => event 3 of 19th
[eventTitle] => 19th event 3
)
...
...
Şimdi aşağıdakilerden gibi yapmak istiyorum.
19 için örneğin
<li>
<span class="title">19th event 1</span>
<span class="desc">event 1 of 19th</span>
</li>
<li>
<span class="title">19th event 2</span>
<span class="desc">event 2 of 19th</span>
</li>
<li>
<span class="title">19th event 3</span>
<span class="desc">event 3 of 19th</span>
</li>
Ben aşağıdaki çalıştı. Bu ancak Codeigniter PHP çalışıyor. Yani birisi bana dışarı ile yapmak için başka bir yol söyleyebilir umuyorum. =
Şimdiden teşekkürler.
$events[intval($row_event->day)] .= '<li><span class="title">'
.stripslashes($row_event->eventTitle).
'</span><span class="desc">'.stripslashes($row_event->eventContent).
'</span></li>';
Ve aşağıdaki modelin detaylar.
$events = array();
//query the database for events between the first date of the month and the last of date of month
// $result = mysql_query("SELECT DATE_FORMAT(eventDate,'%d') AS day,eventContent,eventTitle FROM eventcal WHERE eventDate BETWEEN '$current_year/$current_month/01' AND '$current_year/$current_month/$total_days_of_current_month'");
$query = $this->db->query("SELECT DATE_FORMAT(eventDate,'%d') AS day,eventContent,eventTitle FROM eventcal WHERE eventDate BETWEEN '$current_year/$current_month/01' AND '$current_year/$current_month/$total_days_of_current_month'");
foreach ($query->result_array() as $row_event)
{
$events[intval($row_event['day'])] .= '<li><span class="title">'
.stripslashes($row_event['eventTitle']).'</span><span class="desc">'
.stripslashes($row_event['eventContent']).'</span></li>';
...
...
- GÜNCELLEME -
Kontrolör
Görünüm
Hatalar
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 17
Filename: models/mcalendar_one.php
Line Number: 38
Array
(
[day] => 17
[eventContent] => event 1 of 17th
[eventTitle] => 17th event 1
)
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 19
Filename: models/mcalendar_one.php
Line Number: 38
Array
(
[day] => 19
[eventContent] => event 1 of 19th
[eventTitle] => 19th event 1
)
...
...