Matt,
I've put this back on the list because other people are smarter than me/can
reply more quickly! (and I hate people who pretend to have 'the answer' when
they're plainly out of their depth/range of experience - so...)

I don't think that I've managed to completely understand where you are
heading with this. Possibly because we have different (programming language)
backgrounds/application histories. I don't understand why if $varsused is
already a list with comma separators that you want to use the "|" instead,
when CSV is so widely used/understood/available. Explode/Implode work to
communicate between a string and an array. Perhaps string replacement
functions or regular expressions would meet your needs more appropriately?

The (annotated) online manual has a number of examples and all manner of
ideas in the user contributed comments. The manual's definition section also
suggests looking at other 'similar' commands, eg the explode page offers
"See also preg_split(), spliti(), split(), and implode()." I recommend that
you work your way through the string and filesystem function
chapters/appendices of the manual to see what catches your attention/strikes
a chord with your preferences/history/intentions. When working with a 'new'
language it is usually a mistake to try to make it work the way your 'old'
one did - also expect your ratio of reading references to writing code to
change markedly!

Regards,
=dn


> I looked through the documentation on implode and explode... it doesn't
> seem to give a good example.
>
> I want to assign the file name, vars and delimiter.
>
> I looked at this example:
> $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
> $pieces = explode(" ", $pizza);
>
> $data = "foo:*:1023:1000::/home/foo:/bin/sh";
> list($user,$pass,$uid,$gid,$gecos,$home,$shell) = explode(":",$data);
>
>
> But got all confused.
>
> Isn't there a piece of code that I can write so it will look like this:
>
> $filename = "datafile.txt";
> $varsused = "var1,var2,var3";
> $delimiter = " |  ";
>
> then the opposite of that to import/implode the records as well as to
> apply the filter?
>
> I know I'm new but I've used other programming languages where it's
> easier and more intuitive to import/export records and put filter on
> them.  Thanks.
>
> -Matt
>
>
> Dl Neil wrote:
> > Matt,
> > Welcome to the PHP and MySQL communities!
> >
> >
> >>I have lots of questions and am new to the list... so alas I hope I'm
> >>posting to the correct area. In PHP and MySQL... can you import and
> >>export to flat files?
> >
> >
> > =yes, check out the online PHP manual, appendix XXX, Filesystem
Functions
> > (http://uk2.php.net/manual/en/ref.filesystem.php)
> >
> >
> >>I want to export a series of vars, IE:
> >>Name, Age, State
> >>Bill  25   NY
> >>So that in a file, it will appear like so:
> >>Bill|25|NY
> >
> >
> > =check out the online PHP manual by entering implode and/or explode into
the
> > (functions) search facility
> >
> >
> >>With one record per line, separated by a delimiter?  And then import
> >>those record by being able to set a filter to sort all people from NY or
> >>all people that are 25 years old.
> >
> >
> > =sounds like a job for an RDBMS rather than a flat file, but there you
go...
> >
> >
> > =check out the online PHP manual for string functions and/or regular
> > expressions
> >
> >
> >>Also, I've been trying to playing around with PHP and MySQL.  I haven't
> >>found a great tutorial. Anyone know of a good link?  I'm comfortable
> >>somewhat with the myphpadmin to manage the mysql db, but other than
> >>that, I haven't found anything simple that goes indepth including:
> >>Sorting records IE... alphabetizing certain fields or sorting them by
> >>descending etc.
> >
> >
> > =it sounds as if you need to learn SQL. There are a huge number of
tutorials
> > available on the web (...check out Google). Better yet - visit the MySQL
> > site and follow the links to a "Links" page. This will direct you to a
> > number of sites that offer helpful articles and tutorials. Similarly the
PHP
> > site will point you to many great resource sites.
> >
> > =Don't overlook the online MySQL manual's Chapter 3 which is a
step-by-step
> > tutorial. There are many books available which introduce MySQL or PHP or
> > both together, and are most useful because you can read up the theory
and
> > then work through examples step-by-step.
> >
> >
> >>AND I haven't found much reference on DB locking to prevent file
> >
> > corruption.
> >
> > =check out the online MySQL manual (it has a search facility too)
> >
> >
> >>Any help to these issues would be great!
> >
> >
> > =did you detect a theme? The manuals are really v.good!
> > Sorry if it seems unhelpful to answer in this way, but help-yourself is
the
> > first law of the OpenSource jungle!
> >
> > =Regards,
> > =dn
> >
> >
>
>
> --
> Matt Zur
> [EMAIL PROTECTED]
> http://www.zurnet.com
>
> Need a Web Site??? - Visit... www.zurnet.com
>
> 1997 - 2002 - 5th Anniversary!!!
>
>
>


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

Reply via email to