Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Small PHP Question

Discussion in 'General Discussion' started by jackal, Jun 15, 2003.

  1. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    316
    We need a little help with code below, We are dumping mysql db with php file name june.sql.
    Problem is the way we are doing it instead of new file everytime it appends the file. We need some coding before the dumping to either clean the file or remove where only the new dump shows up.
    Hoping someone can help.

    <?
    //server part config
    $server_dumppath="/home/user/public_html/db/"; //path to dump on server file (must be web acessable, 777 and protected with .htaccess)
    $server_mysql_tablename="dbname"; //name of mysql db to dump
    $server_mysql_username="dbusrname"; //mysql username
    $server_mysql_password="pass"; //guess
    //end config
    exec("mysqldump -u ".$server_mysql_username." -p".$server_mysql_password." ".$server_mysql_tablename." > ".$server_dumppath."june.sql" );
    ?>

    cPanel.net Support Ticket Number:
     
  2. SoftmegUK

    SoftmegUK Well-Known Member

    Joined:
    Feb 13, 2002
    Messages:
    372
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    UK
    Why not just put:

    <?
    //server part config
    $server_dumppath="/home/user/public_html/db/"; //path to dump on server file (must be web acessable, 777 and protected with .htaccess)
    unlink($server_dumppath."june.sql");
    $server_mysql_tablename="dbname"; //name of mysql db to dump
    $server_mysql_username="dbusrname"; //mysql username
    $server_mysql_password="pass"; //guess
    //end config
    exec("mysqldump -u ".$server_mysql_username." -p".$server_mysql_password." ".$server_mysql_tablename." > ".$server_dumppath."june.sql" );
    ?>

    cPanel.net Support Ticket Number:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    316
    Thanks Worked Great!!

    cPanel.net Support Ticket Number:
     
  4. SoftmegUK

    SoftmegUK Well-Known Member

    Joined:
    Feb 13, 2002
    Messages:
    372
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    UK
    Not a problem :)

    cPanel.net Support Ticket Number:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice