> <recordset>
>     <record id="1" name="Mr Smith" purchases="2"/>
>     <record id="2" name="Mr Jones" purchases="25"/>
>     <record id="3" name="Mr Davis" purchases="7"/>
> </recordset>
> 
> There are two approaches I think. One is to use the XML DOM, the other is
> simply to join lots of strings together. What is the best approach?


What i have done in the past is use the dbx extension in php to do my
queries. Then i have iterated over the multi-dimensional arrays and
created xml tags with the values for the dbx result set.

You can use this type of logic with any db functions and just create xml
data.

If you have an xml record that is very specific you can use sprintf to
create something like:

$record = '<record id="%d" name="%s" purchases="%d"/>';

while( $row = database logic here ) {
  $records[] = sprintf( 
        $record, 
        $row['id'],
        $row['name'], 
        $row['purchases'] 
  );

}

Then use the array functions to merge, sort or whatever you like...

That should get you started...

HTH

--
Ray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to