Php array to string conversion error with SLIM framework -
i used php framework pass variable $data html page echo in loop here index.php :
$result=$db->query('select * test'); while ($row=$result->fetch(pdo::fetch_assoc)) { $data[]=$row; } $app->render('form.php',$data));
and display form.php
foreach ($this->$data $user) { echo $user['id']. '-' . $user['name'].'<br>' }
i array string conversion error, idea ? tired var_dump($this->$data);
instead of foreach loop , same error : array string conversion
maybe $this->data instead of $this->$data
foreach ($this->$data $user) { echo $user['id']. '-' . $user['name'].'<br>' }
Comments
Post a Comment