Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Here is another problem! reading from file "readfrom.txt", i would like to generate config.txt with the content:
[syntax="html"]<td>name1</td>
<td>michelangelo</td>
<td>name2</td>
<td>michelangelo</td>
.
.
.name3
picasso.
Where did I go wrong - again?
readfrom.txt[/syntax]
Code: Select all
name1;michelangelo
name2;klimt
name3;picassoCode: Select all
<?php
$row = 1;
$fh = fopen("readfrom.txt", "r");
while (($data = fgetcsv($fh, 512, ";")) !== FALSE)
{
$num = count($data);
$row++;
$nf = fopen("c://apache//htdocs//di//config.txt", "w");
for ($c=0; $c < $num; $c++)
{
$content = $data[$c];
fwrite($nf, $content);
echo $data[$c]. "<br />\n";
}
fclose($nf);
}
fclose($fh);
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]