This is really a question for SO as this is not a review. However, if you were to have asked this there they would have downvoted this so quickly your head would have spun. You should really google these kinds of things before asking for help, as this is well documented. That warning alone would have been enough to answer your question.
However, the reason for this error is because that is a class method, not a variable. And a static one to boot. That strict warning, which any warning or error should always be listened to, is telling you that there is nothing to reference. Referencing automagically duplicates any changes you make to $db
and applies them to whatever variable it is referring to, effectively cloning it. So now you begin to see a problem. You are not referencing a variable, as I said, you are referencing the return value of a method which is merely a section of the memory and cannot be referenced.
So, you could do this:
$temp = JFactory::getDBO();
$db =& $temp;
And it would work just fine. However, this is completely unnecessary. Referencing is completely unnecessary here. What you really want to do is just set that method's return value to a variable and use that in the rest of your code. Usually, especially for people just starting programming, referencing is not necessary. You can accomplish the same thing by assigning the previous variable to a new variable, making the changes, then reassigning the new variable back to the old variable. Leave referencing alone until you learn a little more and can better understand it. Even after years of programming I rarely use it.