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

  • Home
  • SEARCH
  • 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 674397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:42:08+00:00 2026-05-14T00:42:08+00:00

I have a codeigniter code that is working on local Apache installation. But it

  • 0

I have a codeigniter code that is working on local Apache installation. But it does not work on Godaddy Hosting.

I have got other similar views and controllers which are working on Godaddy.

Following is the code. I have pasted only relevant code.

Controller:

function index() {
$this->load->model(‘Feedmodel’);
$data[‘posts’]=$this->Feedmodel->gethomedata();
$this->load->view(‘home’,$data);
}

View:
PHP CODE ONLY

foreach($posts as $post){

    echo $post['url'];  

}

The error that I am getting is

A PHP Error was encountered
Severity: Notice

Message: Undefined variable: posts

Filename: views/home.php

Line Number: 59

A PHP Error was encountered
Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: views/home.php

Line Number: 59

The same code is working fine with other controllers and views…

  • 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-14T00:42:08+00:00Added an answer on May 14, 2026 at 12:42 am

    The reason that you are getting an error notice in the GoDaddy environment and not in your local installation is most probably because of different error reporting in the two php installations. Edit your local php.ini and index.php in the root codeigniter dir and verify that error_reporting(E_ALL); exists.

    Also are you using the foreach loop to iterate through all the HTTP POST variables? if so try changing it to

    foreach($_POST as $post){
    
        echo $post;
    
    } 
    

    you could also use codeigniter’s input library to do this.

    $post_url = $this->input->post(‘url’);

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

Sidebar

Related Questions

Does Codeigniter 2 have a cleaner way of doing what's shown in the code,
I have a codeigniter multistie install where I have such code that I can
In some code I'm working on I have noticed that several variables are being
I use this http://goo.gl/d3vLW code for my project, but it's not working the way
I am using codeigniter 1.7.3 and I have controllers set up and working, but
I'm working on a project, using CodeIgniter, that will have to process credit card
I have this controller in Code Igniter that begins with class MyController extends CI_Controller
I have this function in a Code Igniter model that creates a new video.
I am using Codeigniter message library. In my controller I have the following code
I recently upgraded to CodeIgniter 2.1. The below model code (machforms_model.php) was properly working

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.