dongqiangou5724 2011-03-14 09:21
浏览 24
已采纳

我可以使用此数据库包装类来连接两个以上的数据库

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 execute 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?

  • 写回答

1条回答 默认 最新

  • doudiao2335 2011-03-14 09:34
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制