Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 549075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:08:47+00:00 2026-05-13T11:08:47+00:00

I have the following array outputs. Array ( [day] => 17 [eventContent] => event

  • 0

I have the following array outputs.

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
)
...
...

Now I want to make it like the followings.

For example for 19th

<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>

I tried the following. It works fine in PHP but not in Codeigniter. So I am hoping someone can tell me another way to do with out .=

Thanks in advance.

$events[intval($row_event->day)] .= '<li><span class="title">'
.stripslashes($row_event->eventTitle).
'</span><span class="desc">'.stripslashes($row_event->eventContent).
'</span></li>';

And the following is the details of the model.

$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>';
...
...

–UPDATE–

Controller

Code here

View

Code here

Errors

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
)
...
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:08:48+00:00Added an answer on May 13, 2026 at 11:08 am

    This can simplified quite a bit. First, look at Active Record in CI’s database class, it will make your DB calls 100% easier.

    Why can’t you pass the array back to the view and inject it there?

    Your view may look like

    <?php foreach ($row_event as $event) : ?>
      <li>
      <span class="title"><?php echo $event->eventTitle; ?></span>
      <span class="desc"><?php echo $event->eventContent; ?></span>
      </li>
    <?php endforeach; ?>
    

    That will loop through your array of event details and make your list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 386k
  • Answers 386k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think that it might work if you create another… May 14, 2026 at 11:52 pm
  • Editorial Team
    Editorial Team added an answer jQuery Tabs hold HTML divs much as a normal HTML… May 14, 2026 at 11:52 pm
  • Editorial Team
    Editorial Team added an answer If you just want to constantly overwrite the same line,… May 14, 2026 at 11:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.