Jump to content

Nax

New Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Nax's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh dear, I'll just do it manually I think, trying to learn yet another new code just isn't worth the hassle, I mean it may all just change again next year. I hate it when things aren't backward compatible. Thanks anyway.
  2. I had to move hosters recently and I have a couple of scripts run using CRON to backup my MySql database and manage the number of backups that I keep. I can ask the hosters to deprecate the version of PHO backwards but I don't want to lose the opportunity of features that may be available in the new version. The main script essentially performs a MySqlDump to a specified directory and then emails me to tell me that it completed successfully. The second script just deletes any files in the backup folder more than x days old. I know mysqldump is a valid call so I should need to use anything other than that but I'm lost when it comes to seeing what is wrong with my scripts. backup.php <? $datestamp = date("Y-m-d"); // Current date to append to filename of backup file in format of YYYY-MM-DD // run the command php -q /home/mysite/public_html/scripts/ffbackup.php /* CONFIGURE THE FOLLOWING SEVEN VARIABLES TO MATCH YOUR SETUP */ // require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php"); require("/home/mysite/config/db_config.php"); $connection = mysql_connect($db_host, $db_user, $db_password); mysql_select_db($db_name, $connection); //$dbuser = $db_user, $conection ; // Database username //$dbpwd = ($db_password, $conection); // Database password //$dbname = ($db_name, connection); // Database name. Use --all-databases if you have more than one $backdir ="/home/mysite/forumbackup/"; $filename= "backup-$datestamp.sql.gz"; // The name (and optionally path) of the dump file $to = "my-email@address.com"; // Email address to send dump file to $from = "admin@mysite.com"; // Email address message will show as coming from. $subject = "Mysite MySQL backup file-$datestamp"; // Subject of email $command = "mysqldump -u $db_user --password=$db_password $db_name | gzip > $filename"; $result = passthru($command); $newfile = $filename; copy ($filename, $backdir.$newfile); $message = "Compressed database backup file $filename copied to backup directory."; $headers = "From: $from\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $message, $headers); unlink($filename); //delete the backup file from the server ?> and delold.php <?php $path = "/home/mysite/forumbackup/"; //echo "script is running"; //echo "the path is $path "; if (is_dir("$path") ) { $handle=opendir($path); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { $Diff = (time() - filectime("$path/$file"))/60/60/24; if ($Diff > 10) unlink("$path/$file"); } } closedir($handle); } ?>
  3. OK I've retired and have too much time on my hands. I go to loads of music recitals and was trying to find a database in which to record all these events, Where, when, who, what was played, who was the composer of each piece played, major instrument details. I don't want to reinvent the wheel(mankind hasn't that much time for me to complete a php/mysql project). Ok a hammer to crack a walnut you may think. I want to initally run this on my home network for the family but I can see some potential for a wider "audience". Does anyone know of something similar or something that could be adapted to do this. I have searched but most music resources are concerned with cataloging cd collections. I'm looking to run this on mysql/php as it's the only things I have the least bit knowledge about. Old duffer thanks you in advance.
  4. Just reading up, would it be easier to uninstall and use Wamp5 ? I'm running Vista all I want to do s learn by setting up a devleopment environment on my laptop, MySql, Apache, PHP. Have decent PHP editor.
  5. No I did a search and can't see it there :-\ Attached a copy of my phpinfo [attachment deleted by admin]
  6. more info:- The file php_mysqli.dll exisits in c:\php creating a file containg phpinfo() brings back the phpinfo page ok
  7. I admit it, I'm a complete noobie, bought a laptop coz I'm supporting a SMF forum similar to this and I know noting about PHP or MySQL. OK first thing - bought a book, Teach Yourself MySql, Apache,PHP. Installed all from download sites and I think all three elements are working. Started to foloow the instructions in the book at the point where I want to get a web page to talk to a database. Used the sample given to test connectivity: <?php $mysqli = new mysqli("localhost", "nax", "250558", "test"); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("host information: %s\n" , mysqli_get_host_info($mysqli)); } ?> result = Class 'mysqli' not found 2 mysqlconnect.php C:\Program Files\Apache Group\Apache2\htdocs Fatal error The book hasn't even mentioned classes yet! so I've fallen at the first hurdle (I am not a programmer even minor HTML is an unknown). Anyone steer a newborn in the right direction? :-\
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.