Jump to content

Data in text file instead of mySQL database.


strago

Recommended Posts

What's the code to translate

 

$insertCount=0;
        foreach($results[1] as $content)
$insert = mysql_query("INSERT INTO `table` (`name`) VALUES ('$content')");
       {
            if($insert){$insertCount++;}
        }

 

into puting it in a text file? I try

 

        $insertCount=0;
        foreach($results[1] as $curEmail)
        
        define("DATABASE_FILE","/public_html/file.txt");
    $databaseEntry = "$content\r\n\n";
    {
        $databaseFile = fopen(DATABASE_FILE,"a");
    }
    fwrite($databaseFile,$databaseEntry);
    fclose($databaseFile);
           {
            if($insert){$insertCount++;}
        }

 

and it does put the content in the file....over and over and over and over.....

 

I can't figure out where $insert goes. I think the counting is messing it all up.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.