Hi all,
Can someone tell me how to set our own global variable that share
same value for each client connected to mysql server?
i tried this :
Select max(invoiceNumber) + 1 from invoiceMaster into @no;
but @no is only available at current session.
How to set this @no to be global so when each client "Select @no;"
they will share the same value?
I think this solution to solve invoiceNumber problem.
If there is 2 client connected to mysql server and suppose
currently on invoiceMaster, there are 1 row with invoiceNumber 1.
When they open invoice form using "Select max(invoiceNumber) + 1 from invoiceMaster", each client will get same invoiceNumber which is 2.
And if they try to save the invoice, there will be problem because
invoiceNumber is a primary key.
So, i think there should be some global variable on the server.
So, when client A open the invoice form, this global variable(@no) will be set to max(invoiceNumber) + 1 which is 2;
If client B try to get the currently available invoiceNumber, @no
will be set to @no+1 which is now 3.
If one of them cancel the transaction, @no will be set to @no-1.
Do you guys know other solution?
Thanks folks.
Oh ya, i use mysql 5.0.27
PS

orry if i put this question on wrong section.