This is really a question for SO as it is not a review. However, if you asked about this, they would start it so fast that your head would spin. You should really google such things before asking for help, as this is well documented. This warning would be enough to answer your question.
However, the reason for this error is that it is a class method, not a variable. And static to boot. This is the strictest warning, which you should always listen to in any warning or error, tells you that there is nothing to refer to. The link automatically copies any changes you made to $db , and applies them to any variable to which it relates, effectively cloning it. So now you are starting to see the problem. You are not referring to a variable, as I said, you are referring to the return value of a method, which is just a section of memory and cannot be bound.
So you can do this:
$temp = JFactory::getDBO(); $db =& $temp;
And all will be well. However, this is completely unnecessary. The link here is completely unnecessary. What you really want to do is simply set the method to return the value of the variable and use it in the rest of your code. Usually, especially for people who are just starting to program, links are not needed. You can do the same by assigning the previous variable to a new variable, making changes, and then reassigning the new variable to the old variable. Leave links only until you learn a little more and can better understand this. Even after years of programming, I rarely use it.
source share