[thelist] PHP coding help

dante dante at vianet.net.au
Fri Sep 7 06:52:23 CDT 2001


Thanks,
I've almost got it working.
What I've got do far:
-----------------------------------
<?php

$readID = "";
$id = "";
$dataID = "";
$writeID = "";
$filename = "../xml/id_list.xml";

//Open & read the XML doc
     $f = fopen($filename, "a+");
     $readID = fread($f, filesize($filename));
     fclose($f);
     unlink($filename);

//Open & write to the XML doc
     $f = fopen($filename, "a+");
     $id = substr($readID, strlen($readID)-20, 5);  

        echo "$id";       /* Returns 00006 */

     $id = $id + 1;         

        echo "$id";       /* Returns 00007 */

     $dataID = "<id>".$id."</id></id_list>";    

        echo "$id_data";   /* Returns <id>00007</id></id_list> */

     $writeID = str_replace("</id_list>",$dataID,$readID); 
     fwrite($f, $writeID);
     fclose($f);

?>
-----------------------------------
I can't seem to grasp what it is I'm missing - a typo or something?

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





More information about the thelist mailing list