View Full Version : PHP Easy question about data parsing
andrewlong
January 7th, 2010, 08:49 PM
To lead this off, I'll say that I am a PhP/progamming-in-general noob. I have a PhP script that takes XML data sent from a .swf movie and writes it to a .csv file. One of the pieces of data is a string of numbers that usually starts with one of more zeros. The data is saved fine in the actionscript (its treated as a string, so the zeros remain). In the .csv file the leading zeros are never there. The problem either lies in PhP script or the XML data. If the XML is the problem, does anyone know how to create an XML object that keeps leading zeros in a numerical string (i.e. <id>001234</id> )? If the issue lies in the PhP script, does PhP have typing or something similar that will allow it to see a number as a string, so it does not drop leading zeros?
IQAndreas
January 7th, 2010, 09:08 PM
First you need to find out WHERE the zeroes are disappearing.
Use several "echo" statements in the PHP file, and keep documenting the values each time they are changed in some way. Pretty soon you will find where it is occurring, and you can post the code for it and make it a lot easier on us. ;)
andrewlong
January 7th, 2010, 09:29 PM
thanks for the reply, and touché on the figuring out where and supplying code thing... this post actually appears to be pointless. Once I echoed a bunch (actually I printed... is there a difference between print and echo?) I noticed the data seems intact all the way through script. Then I looked at the .csv file in notepad instead of excel, and the zeros are there as well. So it's an excel problem; which is different forum entirely. Thanks for the quick reply though.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.