$XMLFormatedString .= "<Filter id='" .= .$row->id. .="' name='" .= .$row->label. .="'><Label>" .= .$row->label. .="</Label></Filter>";
views:
55answers:
3
+1
A:
You have multiple syntax errors:
.= "<Filter id='" .= .$row->id.
Should be:
.= "<Filter id='".$row->id.
etc...
Adam
2010-09-14 19:41:22
+2
A:
The left hand side of an assignment operator like .=
needs to be a variable. But in this case "<Filter id='"
is not a variable.
I guess you meant the normal string concatenation operator .
:
$XMLFormatedString .= "<Filter id='" . $row->id . "' name='" . $row->label . "'><Label>" . $row->label . "</Label></Filter>";
Gumbo
2010-09-14 19:41:42
+4
A:
You can't chain the .= operator like that. it's also not nessecary in this case, you can just use the . operator after the first one:
$XMLFormatedString .= "<Filter id='" .$row->id. "' name='" .$row->label."'><Label>" .$row->label."</Label></Filter>";
also, whatever you're trying to do, it looks like a bad idea. you should use something like PHP DOMDocument to write XML.
GSto
2010-09-14 19:42:01
+1. Especially for the DomDocument bit... But fyi: you can chain the `.=` operator in general. `$f = 'f'; $o = 'o'; $f .= $o .= 'obar';` will end with `$f == 'foobar'` and `$o == 'oobar'`. But you can't have a static string (non-variable) anywhere to the left of the `.=`...
ircmaxell
2010-09-14 20:16:01