login about faq

Due to the large amount of spam accounts, we temporarily disabled new user sign ups. To override this, email newuser.lgqa@gmail.com and an admin will determine if you are permitted to join


0
1

Hello all, I am writing a series of PHP functions for my site and I wanted an easy way to backup my databases however I am not sure if this will work and my server is broken at the moment (no external css files work when the file is .php but do when the files are .html) and can't test this.

Would you mind having a look at it and telling me any problems you see in it:

    //Backs up all MySQL databases and tables to 'mysql-DATE.sql' - REMEMBER TO UPDATE USER AND PASS
function backupMySQL()
{
    $date = DATE();
    $user = "root";
    $pass = "";

    $file = "mysql-".$date.".sql";

    mysqldump -u $user -p $pass --all-databases > $file
}

The parts I am most doubtful about are the file name. Thank you for your time and I hope you will be generous enough to look through the code for me. Dom Chester

asked Jun 08 '11 at 12:09

DomChester's gravatar image

DomChester
391121625


mysqldump -u $user -p $pass --all-databases > $file

I'm not sure whether or not you're running a VPS or just have shared hosting but this definitely wouldn't work on shared, I'd suggest doing it through phpMyAdmin if you can as that's generally the easiest way of doing it, otherwise you should try doing it with a MySQL query.

answered Jun 09 '11 at 23:04

Hugo's gravatar image

Hugo
1.7k243151

Don't really know much about MySQL, but perhaps this template can help get your external CSS showing up on your .php pages. Not sure what you've tried, or if this will help, but just thought I would try to help. :)

<?php 
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />"; 
?>

answered Jun 08 '11 at 12:30

jasonvstrange's gravatar image

jasonvstrange
162

Thank you for that I'll try it when I get back to my laptop.

Once again thank you.

(Jun 09 '11 at 14:27) DomChester DomChester's gravatar image

Ok Thank you for your help, its a localhost server but I have since set up PHPMyAdmin - It makes life so much easier!!! Thanks

answered Jun 12 '11 at 05:13

DomChester's gravatar image

DomChester
391121625

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported


Join Us in the Chat Room

Tags:

×96
×96
×42
×29
×29
×11

Asked: Jun 08 '11 at 12:09

Seen: 1,644 times

Last updated: Apr 24 '12 at 13:20