dsbpaqt61965 2013-12-27 18:32
浏览 30
已采纳

cakephp有2个数据库用于登录和crud

I have been trying to recreate an application for straight PHP to CakePHP and I been running into a few problem along the way. I have used the tutorial for Cakephp which was most helpful.

The first problem is that I have two databases that one read the login information and one writes the information to the other database for that logged in user. The kicker is that it's using ODBC database not MySql which I was hoping for.

The second is how to tie the Crud and login controllers together with the two databases.

Any help will do, I've trying to learn and use CakePHP in my spare time. Thanks for any help.

  • 写回答

1条回答 默认 最新

  • dsutuyxe088689 2013-12-27 20:02
    关注

    You can define multiple database configs in database.php:

    $default = { //settings };
    $secondary = { //settings };
    

    Then in your model, set which config it uses by settings its $useDBConfig property:

    var $useDbConfig = 'secondary';
    

    So just set your user model to use one database, and your tables relating to CRUD using another.

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

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么