Hello! Help, please, have such a calculation.
<?php $queryps=$bd->query("SELECT COUNT(id_ms) FROM messages WHERE from_id!=$myrow2[id] AND is_read='0'"); $pos = $queryps->fetch(PDO::FETCH_NUM); ?> Where the variable $myrow2[id] equal to my id. The problem is that here there are 2 users in the first one correctly, for example 3, and in the second one, for example, also 3 not read, but for some reason, that place 3, 13. Please help me, where is my mistake?
messages(id_msint (11) NOT NULL AUTO_INCREMENT,group_hashint (11) NOT NULL,from_idint (11) NOT NULL,messagetext COLLATE utf8_unicode_ci,timemsgdatetime NOT NULL,is_readenum ( '0', '1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',from_user_deleteint (1) NOT NULL DEFAULT '0',to_user_deleteint (1) NOT NULL DEFAULT '0', PRIMARY KEY (id_ms), KEYfrom_id(from_id), KEYis_read(is_read)) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 1; - andreykartavtsevmessages(id_ms,group_hash,from_id,message,timemsg,is_read,from_user_delete,to_user_delete) VALUES (63, 29542, 6, 'What are you doing?', '2014-05-03 09:00:24', '1', 0, 0), - andreykartavtsev