spirit_infernal Posted March 9, 2018 Share Posted March 9, 2018 Hello everyone. I want to get id_order for further usage, but after few attempts have no luck with it. public static function getIdOrder($id_cart) { return Db::getInstance()->executeS( 'SELECT id_order FROM '._DB_PREFIX_.'orders WHERE id_cart = '.$id_cart ); } this function return bool(true), if I set executeS($sql, false, false) it return only string like 'SELECT id_order FROM ps_orders, WHERE id_cart = 4701', not id_order. Different apporoaches found across internet give same results. For example, using $order_object = new OrderCore(); $idOrder = $order_object->getOrderByCartId((int)($mycart->id));; return same bool(true), but not ID. All theese actions are doing for programmatically update order_detail, which oesn't accept sql update injections without id_order. Hope someone help me. Thanks in advance Link to comment Share on other sites More sharing options...
jgamio Posted March 11, 2018 Share Posted March 11, 2018 Change the executeS by GetValue execute is going to return array not a value Link to comment Share on other sites More sharing options...
spirit_infernal Posted March 12, 2018 Author Share Posted March 12, 2018 thanks, will try Link to comment Share on other sites More sharing options...
spirit_infernal Posted March 12, 2018 Author Share Posted March 12, 2018 still return bool(false) with following: public static function getIdOrder($id_cart) { return Db::getInstance()->GetValue( 'SELECT id_order FROM '._DB_PREFIX_.'orders WHERE id_cart = '.$id_cart ); } Link to comment Share on other sites More sharing options...
spirit_infernal Posted March 13, 2018 Author Share Posted March 13, 2018 thanks jgamio. Your suggestion works like a charm. My fault was where I tried to use this function - before cart really creates. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now