0

Not sure how to accomplish this task.

I create a xml file from a mysql database with php.

while ($row = @mysql_fetch_assoc($result)){  
// ADD TO XML DOCUMENT NODE  
$node = $dom->createElement("marker");  
$newnode = $parnode->appendChild($node);   
$newnode->setAttribute("lng", $row['lng']);
$newnode->setAttribute("lat", $row['lat']);
$newnode->setAttribute("title",$row['title']);
$newnode->setAttribute("icon", $row['icon']);
$newnode->setAttribute("rink", $row['rink']);

}

How would I add a column combining 2 rows, for example.

$newnode->setAttribute("custom", $row['rink']<br>$row['rinksize']);

setAttribute does not like more then 2 argument...

Thanks

~edit~

For example I get this result.

<marker lng="-71.062228" lat="42.366303" title="Boston Bruins" icon="red" rink="TD Garden"/>

I would like this.

<marker lng="-71.062228" lat="42.366303" title="Boston Bruins" icon="red" rink="TD Garden" custom="TD Garden<br>20000"/>
1
  • What exactly do you want for the result? Commented Aug 16, 2011 at 2:18

1 Answer 1

1

Oh, you need to concatenate the strings. You probably want to use this: $newnode->setAttribute("custom", $row['rink'] . '<br>' . $row['rinksize']);

The . operator will combine two strings together. Also, just a note: <br> should probably be <br /> for it to be more valid.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.