I think this might be what you want to see...
<?php
$title = "bob's book";
$author = "bobby smith";
$db = "database.txt";
$filename = fopen($db, 'w+');
$book = "$title,$author";
echo "Seperate Variables (\$title and \$author):<br>";
echo "<b>$title<br> $author</b><br><br>";
echo "The string \$book which contains both vars,<br>";
echo "seperated by a comma (no spaces!):<br>";
echo "<b>$book</b><br><br>";
$everything = explode(",", $book);
echo "\$everything Array, Value 1:\n";
echo "<b>$everything[0]</b><br><br>";
echo "\$everything Array, Value 2:\n";
echo "<b>$everything[1]</b>";
echo "<hr><br>";
echo "Attempting to place the \$book data into a comma delimited text file,<br>reopen it, parse it, and place the elements into seperate variables.<br><br>";
fwrite($filename,$book);
$read_data = fopen($db, 'a+');
$data = fgets($read_data);
$parsed_data = explode(",", $data);
foreach($parsed_data as $value)
{
echo "$value";
}
fclose($filename);
?>
It ouputs the following:
Seperate Variables ($title and $author):
bob's book
bobby smith
The string $book which contains both vars,
seperated by a comma (no spaces!):
bob's book,bobby smith
$everything Array, Value 1: bob's book
$everything Array, Value 2: bobby smith
Attempting to place the $book data into a comma delimited text file,
reopen it, parse it, and place the elements into seperate variables.
bob's bookbobby smith