Is it like Laravel Orm can be done by using the query Builder?
Reply content:
Is it like Laravel Orm can be done by using the query Builder?
Is it not normal for PHP to save the result set of a SQL query with an array? How can you say you can't use an array?
The PDO Fetchall returned is an array:
$db->query('SELECT * FROM posts')->fetchAll(PDO::FETCH_ASSOC);
The PHP array is very flexible and can do a lot of things, even in SQL, such as sorting and grouping:
Array (' gold ' = = 8, ' silver ' = + 3, ' bronze ' = + 6,), ' Russia ' + = Array (' Gold ' = ' 3 ', ' Silver ' = + 6, ' bronze ' = 3, ' us ' = + Array (' gold medal ' = 6, ' Silver ' + 8, ' bronze ' =& Gt 8,), ' australia ' = = Array (' gold medal ' = + 4, ' silver medal ' = 0, ' bronze ' = 4, '), ' italy ' = = Array ( ' Gold medal ' = 3, ' silver medal ' = 4, ' bronze ' = 2, ');//Implement ORDER Byforeach ($arr as $k + $v) {$so rt[' Gold medal ' [$k] = $v [' Gold medal ']; $sort [' Silver medal '] [$k] = $v [' Silver medal ']; $sort [' bronze '] [$k] = $v [' Bronze Medal '];} Array_multisort ($sort [' Gold medal '], Sort_desc, $sort [' Silver medal '], Sort_desc, $sort [' Bronze medal '], Sort_desc, $arr); Var_export ($ ARR);//Implement GROUP by (see what values are in the ' Gold field ') $tmp = Array (), foreach ($arr as $k = = $v) {if (In_array ($v [' Gold '], $tmp) = = = FALSE) {$tmp [] = $v [' Gold medal ']; }}var_export ($TMP);