I have made request to SQL:
SELECT meta_value, COUNT(*) from wp_postmeta;
and have in respond an array:
array (size=102)
0 =>
object(stdClass)[24]
public 'meta_value' => string '37' (length=2)
public 'COUNT(*)' => string '147' (length=3)
1 =>
object(stdClass)[23]
public 'meta_value' => string '32' (length=2)
public 'COUNT(*)' => string '143' (length=3)
I take "meta_value" without any troubles with php code:
$result->meta_value;
But how take values of public 'COUNT(*)' => string '143' (length=3)? I have tried different syntaxis and some errors only.
I need values: 147,143...
Use AS to create an alias
SELECT meta_value, COUNT(*) As count from wp_postmeta;
then use count
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With