> I have a file which contains the following syntax:
>
> ; Events listings
> [event]
> month = january
> day = 23
> year = 2003
> venue = some club
> description = this is an event
>
> [event]
> month = january
> day = 12
> year = 2003
> venue = another club
> description = this is another event
>
> Each one of these headers sections represents the start of a new event.
So,
> my code does the following:
>
> $EVENTS = parse_ini_file('./data/events', TRUE);
> while($key = key($EVENTS))
> {
>  $$key = current($EVENTS); //variable variables
>  next($EVENTS);
> }
>
> The problem is that when I try to print the values for $venue, $day, etc,
I
> only get the values for the last section encountered.  I need a way to get
> the values of all the events - do my section heads need to be unique, or
can
> I continue to use the same format in my ini file?

Yes, each section has to be unique, otherwise you're just overwriting the
values each time it's read.

If you want to do it this way, I'd write your own function to read the file
and not use parse_ini_file().

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to