Jump to content

how to use SQL transaction


adller99

Recommended Posts

Hi,

 

I need to use sql transaction for incrementing referender order number. The client wants to have the reference number incremented by 1.

So I've decided to modify generateReference() method within Order class.

 

$custom_last_order_id = Db::getInstance()->getValue('SELECT MAX(reference) AS order_reference FROM '._DB_PREFIX_.'orders ');
        
return $custom_last_order_id+1;
 
how do I secure this to be transactioned?
 
thanks
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...