Jump to content

getting an array (i think) into a text file


glennn.php

Recommended Posts

using fwrite (i can handle that fine) i'm trying to find out how i'd get the results of this query

 


$res = mysql_query("SELECT emails FROM email_list WHERE used != '1' LIMIT ".$limit." ");

while ($row = mysql_fetch_array($res)) {
echo $row['emails']."<br />";
}

 

in such a form as i can then write it to a text file...

 

can someone help me with this, please?

 

much obliged,

gn

 

 

Just fetch them all into an array then foreach through it and write it to the file.

 

$emails = array();
while ($row = mysql_fetch_assoc($res)) {
  $emails[] = $row['emails'];
}

foreach ($emails as $email) {
  // fwrite your $email
}

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.