开发者

Can i use this database wrapper class for connecting more than two databases

I am using this database wrapper class http://www.ajaxray.com/blog/2009/08/29/simple-php-pdo-wrapper-light-static-easy-to-use/

Can i use this Database wrapper class for taking data from one database and insert to other .

If yes then how should i use it ?

e.g. i want to exec开发者_如何学运维ute following query .

echo $select_resellerData = "select * from resellerDetailsEntry where date_format(updatedon,'%Y-%m-%d')='".$date_var.str_pad($i, 2, "0", STR_PAD_LEFT)."'";

        $fetch = querytobeexecutedfrom_A_Db($select_resellerData);

         while($row_reseller = mysql_fetch_array($fetch))
         {
            //echo $row_reseller['alloctype'];
            ##-------------------------------------------Insert into reseller dashboard for each reseller-------------------------------##
            $insert_into ="insert into tbl_reseller_dashboard_intermediate set
            firstname ='".$row_reseller['firstname']."',
            lastname ='".$row_reseller['lastname']."',
            mobile ='".$row_reseller['mobile']."',
            email ='".$row_reseller['email']."',
            citybelongsto ='".$row_reseller['citybelongsto']."',
            cityoptedfor ='".$row_reseller['cityoptedfor']."',
            tmecode ='".$row_reseller['tmecode']."',
            tmename ='".$row_reseller['tmename']."',
            updatedon ='".$row_reseller['updatedon']."',
            apptype ='".$row_reseller['apptype']."',
            empparent='".$row_reseller['data_city']."',


            entrydate ='".$date_var.str_pad($i, 2, "0", STR_PAD_LEFT)."'";

            $run=querytobeexecutedfrom_B_Db($insert_into);
         }

How querytobeexecutedfrom_A_Db and querytobeexecutedfrom_B_Db will be executed with the use of this database wrapper class?


No, you cannot do this, because the wrapper you use uses a static function to assign the current database. This means that inside the wrapper you set a variable that sets your database and that variable doesn't change if you create another instance of the wrapper. To solve this you need to change the wrapper (if you know what you're doing) or use another wrapper.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜