sql - How to store array values into php variable -


$a="select a.name, sum(b.netamount) total      b inner      join on b.transtypeid = a.transtypeid      group name "; $total = mysql_query($a); while($row = mysql_fetch_assoc($total)){   } 

how can store values different php variables?

i assume want extract key values separate variables in local namespace, say, turn this

array(     name1 => val1,     name2 => val2 ) 

into this

$name1 = val1; $name2 = val2; 

you can extract function. here's example:

$arr = array(     "name1" => 1,     "name2" => 2 );  extract($arr);  echo $name1; echo "\n"; echo $name2;  // output: // 1 // 2 

be warned automatically extracting variables namespace can lead elusive bugs if codebase gets complex down line.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -