Trying to get property of non object: preg_match = what?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Trying to get property of non object: preg_match = what?

Post by simonmlewis »

Code: Select all

if (preg_match("/dressing/i", "$rowp->title")) 
I have this code.
And this warning for it:
[text]Notice: Trying to get property of non-object in [/text]
Is it flagging it up because "dressing" hasn't been found? Because there about 8 of these preg_matches and the rest are fine.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Trying to get property of non object: preg_match = what?

Post by Celauran »

No, it's complaining that $rowp isn't an object
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Trying to get property of non object: preg_match = what?

Post by simonmlewis »

Thanks - I found it.
I was using the same $rowp for something else within the code.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply