static function getData($id) { PDOSql::$pdobj = pdoConnect(); $d = PDOSql::select("SELECT name, bg_image, subtitle FROM users WHERE id = ?", array($id)); if (count($d) > 0) { $data['name'] = $d[0]['name']; $data['bg_image'] = $d[0]['bg_image']; $data['subtitle'] = $d[0]['subtitle']; return M::cr(true, $data); } else { return M::cr(false, array('user' => array()), 'No se encontraron datos del usuario'); } }
static function getAll($author = null) { PDOSql::$pdobj = pdoConnect(); $sql = "SELECT * FROM entries {%WHERE%} ORDER BY date DESC"; if (!empty($author)) { $where = array('author = ?'); $bind = array($author); } else { $where = ''; $bind = array(); } $p = PDOSql::select($sql, $bind, $where); if (count($p) == 0) { return M::cr(true, array(), "No se encontraron posteos"); } elseif (count($p) > 0) { return M::cr(true, $p); } else { return M::cr(false, array(), 'Hubo un error con la consulta'); } }