Jump to content

Jimbo_17

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Jimbo_17's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is there any way to load a CSV file into anything like the mysql functions in PHP. For example, PERL can open a CSV file and run queries on it as though it were an SQL database.
  2. Thank you for the quick reply! I am trying to write a class that can treat a comma seperated values file (CSV) like a database. The problem I am running into is I want to have a function iterate through the file and grab the fields from one line at a time and spit them out. I need a way to grab the fields from one line, store them outside the class, and then go get the next line and start it all over. CSV Example: NAME,PHONE,ADDRESS Bob,555-5555,32 Foo Street Shirley,555-5555,RM 354 Barr Apts I want the function to grab Bob's info, split it into an array, and then pass the array out of the class. Once the array is out of the class (In other words, in my index.php), I want it to get Shirley's info and do the same thing.
  3. I am trying to return an array, but only one element at a time. Much in the same way that mysql_fetch_array does. Here is an example of what I am trying to do. [code] class test {   public function one(){     $test = array(1,2,3,4,5);     foreach($test as $array){       return $array;     }   } }; $TEST = new test(); while($blah = $TEST->one()){   print $blah;  //Want this to print out only one element at a time } [/code] Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.