dbprefix}koolielu_waramu_resources WHERE user_guid=".$user_id); foreach ($materials as $material) { try { $obj = waramu_getResource("", $material->waramu_id); $res[] = array($material->waramu_id, $obj->getTitle() . ", " . sprintf(date("d.m.Y", $obj->getDate())), dumbWordShorten($obj->getTitle(), 25)); } catch (Exception $exe) { // Waramu could not return the material, ignoring it } } } echo json_encode($res); ?>