I am fairly new to php so i'm looking for a bit of direction. I am query sql server and i need to do a sum on some of the columns. If i use the array 1,2,3 that works but i don't seem to be able to get the values for impressions_total.
$sql = "SELECT * FROM dash_g_adwords_csv";
$stmt = sqlsrv_query($conn, $sql);
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
//while($row = sqlsrv_fetch_rows($stmt)){
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_BOTH) ) {
//print_r($row);
$impressions_total = array('impressions_total', 'impressions_image', 'impressions_search');
//$impressions_total = array(1, 2, 3);
//$click_total = array('$click_text', '$click_image', '$click_search');
echo
"<tr><td>" . $row['brand'] .
"</td><td>" . $row['period'] .
"</td><td>" . array_sum($impressions_total) .
"</td><td>" . array_sum['$click_total'] .
"</td></tr>";
}
sqlsrv_free_stmt( $stmt);