PDA

View Full Version : MOS database() issue: GROUP BY doesn't return any records


wolfsz
09.06.2004, 09:41
Hi there

I'm not quite certain why this is happening, however the following doesn't return any records

$database->setQuery( "SELECT count(m.responder_id) as msg_count, r.ResponderID FROM InfResp_messages m, InfResp_responders r WHERE m.responder_id = r.ResponderID group by m.responder_id");
$msgs = $database->loadObjectList();
if ($database->getErrorNum()) {
echo $database->stderr();
return false;
}

When I run my SELECT statement directly in MySQL it returns the expected records.
Is the loadObjectList() methos the problem?

Any ideas would be very much appreciated.

expert
09.06.2004, 10:33
hi,

is there an errormessage?

what is the result of print_r($msgs); ?

output the query by echo $database->getQuery(); ? and run the query in mysqladmin? any errors?

loadObjectList() works fine, I would say!