Cita:
Iniciado por dashtrash Mismo problema..Tienes que poner $currentFile como primer parametro en *todas* las llamadas a fwrite..
Ok, ahora si me escribe, pero solo una vez, despues de esa vez, lo que hace es reemplazarme el antiguo texto por el nuevo
Código PHP:
Ver original<html>
<head>
<title>Problema</title>
</head>
<body>
<?php
//Obtenemos ID
$id=$_GET[id];
//Seleccionamos BD
require("conexion.php");
$res=mysql_query("select * from navi where id_navi='$id'",$connect);
$counter=0;
$text="";
$currentFile=null;
$cabecera="
version=7
background=http://ps3tv.square7.ch/fondotaquillas/cine.jpg
title=Nacionales
logo=http://www.todoiphone.net/wp-content/uploads/2012/02/retro-tv-icon.jpg
\n";
$pie="Este es mi pie";
// $res es el resultado de mysql_query de tu consulta.
{
if($counter%40==0)
{
if($currentFile!=null)
{
}
$currentFile=fopen("miFichero".($counter/40).".txt","w"); fwrite($currentFile, $cabecera); }
fwrite($currentFile, "# ".$row[id_navi
]." type=video
name=".$row[titulo]."
thumb=".$row[caratula]."
URL=".$row[url]."
".$row[procesador]."\n\n");
$counter++;
}
if($currentFile)
header("location: publicaciones.php");
?>
</body>
</html>