Re: dynamic db connection | $useDbConfig
This is exactly what I want - but I can't seem to get this to work. I have controller with the following in the index action if ($data_source) { $did_this_work = $this->Model->data_source_changer($data_source); } In the model function data_source_changer($dbconfig) { $success = $this->setDataSource($dbconfig); return $success; } I get no errors but the $did_this_work variable is empty after it runs and I am getting data from the wrong database (did not change data sources) What am I doing wrong here? On Oct 22, 2:45 pm, rtconner <[EMAIL PROTECTED]> wrote: > http://api.cakephp.org/1.2/class_model.html#d45dbbc6a13d9921731abf738... > > On Oct 22, 2:24 pm, carSign <[EMAIL PROTECTED]> wrote: > > > Is there a way to change the config variables inside my model on the > > fly. > > > For example. If a user visits: > > >http://www.example.com/videos/rent/toy_story > > > the page will be returned as normal. But if a user visits, > > >http://www.example.com/videos_qa/rent/toy_storyorsomething like it > > > I want to use the same model, view, and controller but change the > > value of $useDbConfig in the model to use a QA database? > > Is there a good way to do this. I want to have both available. The > > only difference in the page that will be seen by the user will be if > > the data in the database is different. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic db connection | $useDbConfig
http://api.cakephp.org/1.2/class_model.html#d45dbbc6a13d9921731abf738623bb01 On Oct 22, 2:24 pm, carSign <[EMAIL PROTECTED]> wrote: > Is there a way to change the config variables inside my model on the > fly. > > For example. If a user visits: > > http://www.example.com/videos/rent/toy_story > > the page will be returned as normal. But if a user visits, > > http://www.example.com/videos_qa/rent/toy_storyor something like it > > I want to use the same model, view, and controller but change the > value of $useDbConfig in the model to use a QA database? > Is there a good way to do this. I want to have both available. The > only difference in the page that will be seen by the user will be if > the data in the database is different. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
dynamic db connection | $useDbConfig
Is there a way to change the config variables inside my model on the fly. For example. If a user visits: http://www.example.com/videos/rent/toy_story the page will be returned as normal. But if a user visits, http://www.example.com/videos_qa/rent/toy_story or something like it I want to use the same model, view, and controller but change the value of $useDbConfig in the model to use a QA database? Is there a good way to do this. I want to have both available. The only difference in the page that will be seen by the user will be if the data in the database is different. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---