Home php foreach loop in a string
Reply: 0

php foreach loop in a string

user818 Published in April 26, 2018, 5:19 pm

i have a Problem with my foreach:

Parse error: syntax error, unexpected 'foreach' (T_FOREACH)

$pdo = new PDO('mysql:host=localhost;dbname=center24', 'root', '');

$sql = "SELECT `Name`, `SP`, `NP`, `PP` FROM `mitarbeiter punkte`";

$string = '{
"cols": [
    {"id":"","label":"Start Punkte","pattern":"","type":"number"},
    {"id":"","label":"Negative Punkte","pattern":"","type":"number"},
    {"id":"","label":"Positive Punkte","pattern":"","type":"number"}
"rows": [
    '.foreach ($pdo->query($sql) as $row) {.'

echo $string;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.299739 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO