php - loop through array to output data -


i have loop through object called $logs in order display queried data. loop through array of numbers i’ve created in order have them line next each row of queried data. code array string conversion error. know why happening?

$sql1 = "select * client_table group client_name"; $query = $this->db->prepare($sql1); $query->execute(); $logs = $query->fetchall();  $totals = array($darty, $doug, $eliott, $henry, $leo, $neo, $rforgo, $sample,          $susanne, $tim);  foreach ($logs $log) {      echo date("y  m-d  ");     echo "2nd half  ";     echo $log->client_name . " ";     $totals . "\n" ;  } 

on last line: $totals array, , you're concatenating string. tries treat string. either use implode or loop through it. , echo if that's want do.

echo implode(', ', $totals) . "\n"; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -