NYCPHP Meetup

NYPHP.org

[nycphp-talk] CSV/XML

David Sklar sklar at sklar.com
Thu Sep 25 09:17:14 EDT 2003


Well, with SimpleXML in PHP 5, you can do something like

$handle = simplexml_load_file('file.xml');
foreach ($handle as $root) {
    print "$root->name $root->url";
}

David

On Thursday, September 25, 2003 8:49 AM,  wrote:

> speaking of which, a simple fgetxml function would be pretty cool ...
> 
> how id picture it working (without attributes):
> 
> $handle = fopen("file.xml", "r");
> while ($sub = fgetxml($handle, "<root>")) {
>      print "$sub[name] $sub[url]";
> }
> 
> <root>
>    <name>NYPHP</name>
>    <url>http://www.nyphp.org</url>
> </root>
> 
> as for CVS/MYSQL use the syntax LOAD DATA INFILE as described here
> (keep in mind it is a SQL query so you can use PHP to do it):
> 
> http://www.mysql.com/doc/en/LOAD_DATA.html
> 
> - jon
> 
> ----- Original Message -----
> From: "Alexander Chan" <alexander_chan at yahoo.com>
> To: "NYPHP Talk" <talk at lists.nyphp.org>
> Sent: Wednesday, September 24, 2003 10:51 PM
> Subject: Re: [nycphp-talk] CSV
> 
> 
>> i would recommend using fgetcsv function should help you.
>> if you goto http://us3.php.net/fgetcsv there is an
>> example for you.
>> 
>> Alex
>> --- "Donald J. Organ IV" <dorgan at optonline.net> wrote:
>>> what would be the best way to go about letting the
>>> user insert a csv file
>>> into a mysql database and also letting the user
>>> extract certain information
>>> from the server into a csv file.
>>> 
>>> _______________________________________________
>>> talk mailing list
>>> talk at lists.nyphp.org
>>> http://lists.nyphp.org/mailman/listinfo/talk
>> 
>> _______________________________________________
>> talk mailing list
>> talk at lists.nyphp.org
>> http://lists.nyphp.org/mailman/listinfo/talk
>> 
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk



More information about the talk mailing list