Skip to content
Advertisement

Referencing the count in object PHP

I’m trying to reference COUNT(*) from the object below. I grab the date using $the_date = $obj2->the_date as per the below example, but how do I reference count? Of course using COUNT(*) will throw an error.

Advertisement

Answer

You need to alias the concerned column in the resultset of the query, like:

Then:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement