php - Insert into .. select from .. using zend db -


I have the following quick query that takes the item from the shopping cart to the order table:

 Insert webshop_order_item (order_id, product_id, count) 1, select product_id, count from webshop_cart  

I am using Zand DB for all my modeling. I was wondering what is the way to obtain the goal of the above query without using a raw query?

There is no way of inserting it into Zend db yet. However, if you only need this feature for one adapter, then you can use the like-like approach:

  Insert public function ($ tableName, Zend_Db_Select $ select, array $ Fields = array)) {$ FieldString = ''; If (count ($ field)) {foreach ($ field as $ field ka = $ gt; $ field) {$ fields [$ fieldKey] = $ this- & gt; QuoteIdentifier ($ field); } $ String string = '(' .implode (',', $ fields). ')'; } $ Query = "INSERT". $ This- & gt; QuoteIdentifier ($ tableName). $ String ""; $ Query. Select $ $; $ This- & gt; _db-> Query ($ query); }  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -