Tuesday, May 14, 2013

Model capable of Table switching

All,

I need a model that can switch table in the DB to work with the following code:

      switch ($key) {
         case 0:
         case 1:
            // Client & Technology SQL
            // Select * from dropdowns where `module_id`='5000' and `field`='customer';
            // Select * from dropdowns where module_id = 5000 and field = 'technology';
            $sql_str = "SELECT id, label FROM `dropdowns` WHERE `module_id`='5000' AND ".
                       "`field`='$fnd_str';";
            //$form->request->data = RFDropdown->options('dropdowns',array('id','field'),5000,$fnd_str);
            //$cli_ray  = RFDropdown->options('dropdowns',array('id','field'),5000,$fnd_str);
            break;
         case 2:
            // Import Type SQL
            // Select * from dropdowns where module_id = 2000 and field = 'import';
            $sql_str = "SELECT id, label FROM `dropdowns` WHERE `module_id`='2000' AND ".
                       "`field`='$fnd_str';";
            break;
         case 3:
            // Map SQL
            // Select * from `imp_dmap` where module_id = 2000 and field = 'import';
            $sql_str = "SELECT * FROM `imp_dmap` WHERE `module_id`='2000' AND ".
                       "`field`='$fnd_str';";
            break;
         case 4:
            // Table SQL
            $sql_str = "SELECT * FROM `imp_dmap` WHERE `module_id`='2000' AND ".
                       "`field`='$fnd_str';";
            break;
      }  // end switch $key


Can not find any example of this!

Cheers!

OMR

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: