FWRITE the content of an array ? Help ^_^
Posted: Sun Aug 13, 2006 8:47 am
feyd | Please use
When I open the file saved on the hard drives, instead of including all the records of the 'book' array, it only ouptuts :
"array"
weights 5 bytes!
Oh btw, will this work to get back the content of the string :
Thanks for your help ... 
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]
Hello!
So, it might sound pretty easy, but I can't figure out how to export the content of an array to a file.
I use :Code: Select all
<?php
$filename = 'book.dat';
$list = $_SESSION['book'];
$handle = fopen($filename, 'wb');
fwrite($handle, $list);
fclose($handle);
?>"array"
weights 5 bytes!
Oh btw, will this work to get back the content of the string :
Code: Select all
<?php
$filename = 'book.dat';
$handle = fopen ($filename, "rb");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
echo $contents;
?>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]