function action_get_table_elements($id_cloud, $name_table) { $data = Sql::selectOne('cloud', 'id = ?', $id_cloud); if ($data) { $dataA = array(); Sql::select($data['uid'] . '.' . $name_table . ' t'); while ($result = Sql::getData()) { $d = array(); foreach ($result as &$value) { $d[] = $value; } array_push($dataA, $d); } return json_encode($dataA); } else { return json_encode(array('success' => false)); } }
public static function count() { $arguments = func_get_args(); $table = $arguments[0]; $query = 'SELECT COUNT(*) AS number FROM ' . $table; if (count($arguments) > 1) { $query .= ' WHERE '; $query .= Sql::generateQuery($arguments, 1); } Sql::displayDebug($query); $GLOBALS['queries'][] = Sql::rc()->query($query); $data = Sql::getData(count($GLOBALS['queries']) - 1); return $data['number']; }