PHP fopen write to single line

$text = "Here is my new line.";
$newline = "$text\n"
$filename = $_SERVER['DOCUMENT_ROOT'] . "/myfile.php";
if (!($fp = fopen($filename, 'a'))) {
  print 'Cannot open file';
} else {
  if(fwrite($fp, "$newline")){
    print "line written<br />\n";
  } else {
    print "problem writing line\n";
    print 'file closed';
  } else {
    print 'problem closing file';

MySQL backup and restore

DATEVAR=`date +%Y-%m-%d--%H-%M-%S`;
mysqldump -u[username] -p[password] [database_name] > backup_$DATEVAR.sql;
mysql -u[username] -p[password] [database_name] < backup_$DATEVAR.sql;
## In one command, dump the remote into local ##
ssh -C mysqldump -u[remote user] -p[remote pass] [remote db] | mysql -u[local user] -p[local pass] [local db]