diffrent connection create via foreach loop php
I have a big problem in my mind
foreach($allSubBranch as $key => $value){
$gotOtherSql = "esoftcar_".replace_extension($value->db, "sql");
$otherDbNames = "esoftcar_".$value->db;
$file = fopen($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR .
$gotOtherSql,"w+");
ftp_get($connection, $file, $gotOtherSql, FTP_BINARY );
$dbConfig = new PDO('mysql:host=localhost;dbname=' . $otherDbNames,
$_SESSION["db_user_connected"], $_SESSION["db_user_connected_pass"]);
$dbConfig-query($file);
}
I'm going to download sql file via remote server and install into the
different databases in the same host(localhost).
While i using $dbConfig,my script isn't working.Can we use it like this or
any alternative solution ?
No comments:
Post a Comment