This topic is locked

takinng same value users

4/17/2010 3:19:11 PM
PHPRunner General questions
D
danaci author

hi,

I'm using phpr5.1(2135)
my table is
sno int(9) auto_increment,

evrak_no int(9),

..

..
----
I have 3 user and this user same unit(xx)

and this users must be same unit(xx)

--
In my project

function BeforeAdd($values,$message,$inline)

{
$str = "select max(evrak_no) from gelen_evrak where unit=xx";

$rs = db_query($str,$conn);

$data = db_fetch_numarray($rs);

$values["evrak_no"]=$data[0]+1
..

}

My problem is,
While each user must take different numbers,but sometimes the same value for each user.
thnx for solutions

Sergey Kornilov admin 4/19/2010

If two users add a record at about the same time they may be given the same number. You can try to move this code to AfterAdd event to calculate the next number and update the record accordingly.

D
danaci author 4/21/2010

thnx sergey