realjumper Posted May 8, 2007 Share Posted May 8, 2007 Hi, I have a script to backup a particular database. If I create another instance of this script I can backup a different database, and so on. If I have (say) 10 databases to backup, I would have to create 10 instances of this script. That's not the problem. The problem is that rather than create 10 cron jobs, I would like to have one file call the 10 scripts, with a 30 second interval between them. Then I would only need one cron job. Is there a way to have one script call other scripts? I have tried variations on the code below, but only the first script gets called. <?php include_once "backup_scripts/execute_db1_backup.php"; sleep(30); include_once "backup_scripts/execute_db2_backup.php"; ?> Link to comment https://forums.phpfreaks.com/topic/50432-include-question/ Share on other sites More sharing options...
realjumper Posted May 8, 2007 Author Share Posted May 8, 2007 Never mind...I see why this won't work. I have another plan though :-) Link to comment https://forums.phpfreaks.com/topic/50432-include-question/#findComment-247744 Share on other sites More sharing options...
mpharo Posted May 8, 2007 Share Posted May 8, 2007 out of curiosity why wouldnt this work? Link to comment https://forums.phpfreaks.com/topic/50432-include-question/#findComment-247761 Share on other sites More sharing options...
realjumper Posted May 8, 2007 Author Share Posted May 8, 2007 Because if I include the two files, there are some function names in those two files that are the same, but do different tasks because they are for different databases. So I guess there is confusion in the script as to which function I am trying to call...because they both have the same name...._I think!_ Link to comment https://forums.phpfreaks.com/topic/50432-include-question/#findComment-247775 Share on other sites More sharing options...
mmarif4u Posted May 8, 2007 Share Posted May 8, 2007 Yes u r right u have to if statement or switch statement. Also i think u should change this: include_once "backup_scripts/execute_db1_backup.php"; to this: include_once ('backup_scripts/execute_db1_backup.php'); Link to comment https://forums.phpfreaks.com/topic/50432-include-question/#findComment-247776 Share on other sites More sharing options...
neel_basu Posted May 8, 2007 Share Posted May 8, 2007 Also i think u should change this: include_once "backup_scripts/execute_db1_backup.php"; to this: include_once ('backup_scripts/execute_db1_backup.php'); Although I myself use () I think both of them will work. Link to comment https://forums.phpfreaks.com/topic/50432-include-question/#findComment-247848 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.