1
The goal is to extract data from the base and save in txt file... The script works correctly when I enter only $log (name) on the line
if (!fwrite($savelog, $log))
in an attempt to add $log2 (numero)
if (!fwrite($savelog, $log, $log2))
error
( Warning: fwrite() expects Parameter 3 to be long, string Given in)
what solution to store the two data in txt with its proper formatting (str_pad)
?
<?php
include "conexao.php";
$querymail = mysql_query("select nome,numero from listagem");
fopen("listar.txt", "w+");
while($data = mysql_fetch_array($querymail)) {
$log = str_pad($data[nome], 30, " ", STR_PAD_RIGHT);
$log2 = str_pad($data[numero], 30, "0", STR_PAD_RIGHT);
if (!$savelog = fopen('listar.txt', "a"))
{ exit; }
if (!fwrite($savelog, $log, $log2))
{ exit; fclose($savelog); }
}
?>
<a href="listar.txt">Download</a>
The concatenation resulted in solution... Thanks!
– checktech