Jump to content

Recommended Posts

I'd like to be able to echo out the count of all of the conversations_ids.  I'd prefer to do the counting in MySQL

 

The column looks something like

 

Conversation ID's

1

1

1

2

3

3

5

5

5

5

 

$sql = 	"SELECT
		`pm_messages`.`conversation_id` AS `id`
	FROM `pm_messages`
	WHERE `pm_messages`.`conversation_id` = ${conversation['id']}
	GROUP BY `pm_messages`.`conversation_id`";

	$result = mysql_query($sql);

	$replies = mysql_fetch_assoc($result);

	echo count($replies['id']);

 

In this case when ${conversation['id']} = 1  I want $replies to echo out 3

Link to comment
https://forums.phpfreaks.com/topic/227789-count-group/
Share on other sites

In your original thread for this problem, the reply that was posted showed you how to get a count in the (each) group.

Forgot about that, I replied in that thread too ;/

 

Here is the duplicate:

http://www.phpfreaks.com/forums/php-coding-help/total-unique-id%27s-with-php-and-mysql/msg1527852/#msg1527852

Link to comment
https://forums.phpfreaks.com/topic/227789-count-group/#findComment-1174672
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.