spfoonnewb Posted January 25, 2007 Share Posted January 25, 2007 Hi,I have this xml phraser, I am having trouble getting it to display the count.. So basically for each, I want a number.. so $l should output 1-50 or whatever it happens to be.If I replace $l with $xml_index['TITLE'][$i], it just outputs a bunch of random numbers.. 67, 15, 93.. etc.It does currently populate all of those elements, it just doesn't provide the count.[code]<?php;$url = "http://";define(feed, $url);$xml_feed = file_get_contents(feed);$xml_praser = xml_parser_create();xml_parse_into_struct($xml_praser,$xml_feed,$xml_keys,$xml_index);xml_parser_free($xml_praser);for($i = 0; !empty($xml_index['TITLE'][$i]);$i++){for ($l = 1; $l <= 10; ++$l) {if($i == 0){echo ''.$xml_keys[$xml_index['TITLE'][$i]]['value'].'';echo ''.$xml_keys[$xml_index['DATA'][$i]]['value'].'';echo ''.$xml_keys[$xml_index['URL'][$i]]['value'].'';}else{echo ''.$xml_keys[$xml_index['TITLE'][$i]]['value'].'';echo ''.$xml_keys[$xml_index['DATA'][$i]]['value'].'';echo ''.$xml_keys[$xml_index['URL'][$i]]['value'].'';}}}?>[/code] Link to comment https://forums.phpfreaks.com/topic/35612-phpxml-phraser-count-help/ Share on other sites More sharing options...
spfoonnewb Posted January 25, 2007 Author Share Posted January 25, 2007 This was solved with:$l = "1";And using:'.$l++.' Link to comment https://forums.phpfreaks.com/topic/35612-phpxml-phraser-count-help/#findComment-168736 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.