You are here:  » Autonumber rows on XML output

Autonumber rows on XML output

Submitted by rcasey on Mon, 2016-03-28 17:25 in


I'm looking to simply autonumber the rows of the data we're parsing from an XML feed. Currently, we're getting:

Result A 555
Result B 444
Result C 435

I'd like:

1 Result A 555
2 Result B 444
3 Result C 435

Any ideas?

Thank you.

Submitted by support on Tue, 2016-03-29 08:55


Create a counter variable outside of your myRecordHandler() function, and then within the function declare the counter variable as global, increment by 1 and include within your output as required; for example:

$counter." ".$record["FIELD1"]." ".$record["FIELD2"]."\n";

Hope this helps!

Submitted by rcasey on Wed, 2016-03-30 17:34

Thank you, that's exactly what I was looking for!