[thelist] PHP coding help

dante dante at vianet.net.au
Fri Sep 7 05:24:26 CDT 2001


G'Day All,

I've been trying to achieve a way of creating/accessing unique id codes
using a XML document (so it can also be accessed by XSLT) & PHP:

Something like this:

id_list.xml
--------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<id_list>
 <id>00001</id>
 <id>00002</id>
 <id>00003</id>
 <id>00004</id>
 <id>00005</id>
 <id>00006</id>
</id_list>
--------------------------------------------------------

PHP concept
--------------------------------------------------------
1) Load file
     - id_list.xml
2) Read file
    - id_list.xml
3) Search file for last 20 characters
    - 00006</id></id_list>
4) Select first 5 characters (of last 20 from file) & convert to integer
    - 00006
5) Add 1 to integer
    - 00007
6) Replace the end element with the new integer value (within element <id>)
+ new end string.
    -  </id_list> =         <id>00007</id>
                                </id_list>
7) Close file
     - id_list.xml
--------------------------------------------------------

I've worked out how to do some of these, but I'm having problems with steps
3 & 4.

Any suggestions?

Thanks,
            dante
            Perth, Western Australia
            dante at vianet.net.au
            www.vianet.net.au/~dante








More information about the thelist mailing list