creating xml with php and 'if changed' option

jojart

New Member
I am creating an address book xml feed from a MySQL database, everything is working fine, but I have a section tag which gets the first letter of the surname and pops it in that tag. I only want this to display if it has changed, but for some reason my brain isn't working this morning!Current code:\[code\]<?phpecho "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";echo "<data>";do { $char = $row_fetch["surname_add"]; $section = $char[0]; //if(changed???){ echo "<section><character>".$section."</character>"; //} echo "<person>"; echo "<name>".$row_fetch["firstname_add"]." ".$row_fetch["surname_add"]."</name>"; echo "<title>".$row_fetch["title_add"]."</title>"; echo "</person>"; //if(){ echo "</section>"; //}} while ($row_fetch = mysql_fetch_assoc($fetch));echo "</data>";?>\[/code\]Any help on this welcome, don't know why I can't think of it!
 
Back
Top