Home php Creating Default Object From Empty Value Error

Creating Default Object From Empty Value Error

Author

Date

Category

switched to another hosting and picks up the following error.

Creating Default Object from Empty Value

Here is the code

$ Gallery_Guest = $ this- & gt; pages_model- & gt; getProductgallery_Guest ($ ID);
     If (! $ Gallery_Guest) {
       $ Gallery_Guest [0] - & gt; img = "/images/no-image.png";
     }

Error here on this line.

$ Gallery_Guest [0] - & gt; img = "/images/no-image.png";

What to do?


Answer 1

Correct

if (! $ Gallery_Guest) {
   $ Gallery_Guest [0] ["img"] = "/images/no-image.png";
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions