I am trying to pull data out of mysql, place it into an array and write it with html formatting to a .txt includes file. This works but it will not write. It will create the news.txt file but will not write to it... any ideas on how I could make this work? Thanks for your help.
=========== my code =============
<?PHP
mysql_connect("localhost", "username", "pw");
$query = "SELECT id,visible,date,headline,tease,body,link FROM news WHERE visible='1'";
$result = mysql_db_query("client_news", $query);
if ($result) { echo "";
while ($r = mysql_fetch_array($result))
{
$id= $r["id"];
$visible=$r["visible"];
$date=$r["date"];
$headline = $r["headline"];
$tease = $r["tease"];
$body = $r["body"];
$link = $r["link"];
$fp = fopen("news.txt", "w+");
fputs($fp, $id, $date, $headline, $tease, $body, $link);
fclose ($fp);
}
echo ""; } else { echo "No data."; } mysql_free_result($result);
?>
=========== thanks for your help