Esempio n. 1
0
File: all.php Progetto: Ereaey/Cloud
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));
    }
}
Esempio n. 2
0
 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'];
 }