NYCPHP Meetup

NYPHP.org

[nycphp-talk] CakePHP Making a Model return data from a different database.

Bruce Martin bmartin at mac.com
Tue Nov 23 13:54:20 EST 2010


Hi all,
I am assuming there are people on the list who are knowledgeable about cakePHP on this list. I'm still trying to wrap my head around it and so far I'm finding it a bit tricky. I'm currently reading a book about cakePHP, but nee to skip through to resolve the world hunger crisis before I know how to grow corn.

The situation:
I have a model/controller/views(item.php/items_controller.php/view->admin_index.ctp and admin_add.ctp) that display items from a Mysql database. This works just as cakePHP wants, the table is designed with cakePHP in mind and the records are displayed in a table or a single record can be passed to a form for editing. I did not write this code, so maybe my issues are in understanding the code rather than cakePHP.

I need, or want, to create a view that will list records from a non-cakePHP compliant database/table, Informix, in an HTML table that when the user clicks a link, will pre-populate the admin_add.ctp views form. 

I thought I could simply add my code to access this second database in the item.php model, and then call it via the controller, items_controller.php and send it to another view admin_select.ctp. However, I cannot get my function I wrote in the model to substitute the original table results with new results from the second database. 

Am I going about this incorrectly? if so, how would you suggest doing this? The intent is to simply import data from the Informix database into the mysql database when the admin wants to add an item.

Thanks,
Bruce Martin
The Martin Solution
Bruce at martinsolution.com
http://www.martinsolutioncom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20101123/455d8730/attachment.html>


More information about the talk mailing list